2017-03-07 23:06:14 -05:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
2017-03-08 21:55:08 -05:00
|
|
|
|
using Bit.Core.Utilities;
|
2017-03-08 21:45:08 -05:00
|
|
|
|
using Bit.Core.Models.Table;
|
2017-03-07 23:06:14 -05:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
2017-03-08 21:55:08 -05:00
|
|
|
|
namespace Bit.Core.Models.Api
|
2017-03-07 23:06:14 -05:00
|
|
|
|
{
|
2017-04-27 09:19:30 -04:00
|
|
|
|
public class CollectionRequestModel
|
2017-03-07 23:06:14 -05:00
|
|
|
|
{
|
2017-03-09 22:09:09 -05:00
|
|
|
|
[Required]
|
|
|
|
|
|
[EncryptedString]
|
|
|
|
|
|
[StringLength(300)]
|
|
|
|
|
|
public string Name { get; set; }
|
2017-03-07 23:06:14 -05:00
|
|
|
|
|
2017-04-27 09:19:30 -04:00
|
|
|
|
public Collection ToCollection(Guid orgId)
|
2017-03-07 23:06:14 -05:00
|
|
|
|
{
|
2017-04-27 09:19:30 -04:00
|
|
|
|
return ToCollection(new Collection
|
2017-03-07 23:06:14 -05:00
|
|
|
|
{
|
2017-03-09 22:09:09 -05:00
|
|
|
|
OrganizationId = orgId
|
2017-03-07 23:06:14 -05:00
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-04-27 09:19:30 -04:00
|
|
|
|
public Collection ToCollection(Collection existingCollection)
|
2017-03-07 23:06:14 -05:00
|
|
|
|
{
|
2017-04-27 09:19:30 -04:00
|
|
|
|
existingCollection.Name = Name;
|
|
|
|
|
|
return existingCollection;
|
2017-03-07 23:06:14 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|