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-05-09 12:41:36 -04:00
|
|
|
|
using System.Collections.Generic;
|
2017-03-07 23:06:14 -05:00
|
|
|
|
|
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]
|
2017-07-27 14:08:39 -04:00
|
|
|
|
[StringLength(1000)]
|
2017-03-09 22:09:09 -05:00
|
|
|
|
public string Name { get; set; }
|
2017-05-11 12:22:14 -04:00
|
|
|
|
public IEnumerable<SelectionReadOnlyRequestModel> Groups { 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
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|