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 Delete(string clientId, string groupId) { if (string.IsNullOrWhiteSpace(clientId)) { throw new ArgumentNullException(nameof(clientId)); } if (string.IsNullOrWhiteSpace(groupId)) { throw new ArgumentNullException(nameof(groupId)); } var groupDto = new GroupDto { Id = int.Parse(groupId) }; this.context.Groups.Attach(groupDto); this.context.Groups.Remove(groupDto); await this.context.SaveChangesAsync(); }