Example #1
0
        public async Task <ActionResult> RemoveGroup([FromBody] RemoveUserGroupDto groupDto)
        {
            if (!IsAvailableOperation())
            {
                return(BadRequest());
            }

            await _userGroupService.Remove(groupDto, UserId);

            return(Ok());
        }
Example #2
0
        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);
        }