public async Task <ActionResult> RemoveGroup([FromBody] RemoveUserGroupDto groupDto) { if (!IsAvailableOperation()) { return(BadRequest()); } await _userGroupService.Remove(groupDto, UserId); return(Ok()); }
public async Task Remove(RemoveUserGroupDto groupDto, int userId) { var userGroupRepository = DataContextManager.CreateRepository <IUserGroupRepository>(); var group = await userGroupRepository.GetById(groupDto.Id, userId); if (group == null) { throw new NotFoundException("Group", groupDto.Id); } group.IsActive = false; await userGroupRepository.Update(group); }