예제 #1
0
 public static GroupDto FromDomain(Group group)
 {
     return new GroupDto
         {
             Id = string.IsNullOrWhiteSpace(group.Id) ? 0 : int.Parse(group.Id),
             Name = group.Name
         };
 }
        public async Task AddGroup(string clientId, Group group)
        {
            var groupDto = new GroupDto
            {
                Name = group.Name,
                ClientId = clientId
            };

            this.context.Groups.Add(groupDto);
            await this.context.SaveChangesAsync();
        }
        public async Task Update(string clientId, Group group)
        {
            if (group == null)
            {
                throw new ArgumentNullException(nameof(group));
            }

            var groupDto = GroupDto.FromDomain(group);
            groupDto.ClientId = clientId;

            this.context.Groups.Update(groupDto);
            await this.context.SaveChangesAsync();
        }
예제 #4
0
 public GroupApiModel(Group group)
 {
     this.Id = group.Id;
     this.Name = group.Name;
 }