public async Task <IActionResult> Patch(int id, GroupToEditDto GroupDto)
        {
            try
            {
                if (!await _serviceManager.Group.Update(id, GroupDto))
                {
                    return(BadRequest());
                }

                return(Ok());
            }
            catch (System.Exception e)
            {
                return(HandleException(e));
            }
        }
Example #2
0
        public async Task <bool> Update(int id, GroupToEditDto entity)
        {
            var group = await this._unitOfWork.Group.Get(id);

            if (group == null)
            {
                throw new Exception("Not Found.");
            }

            group.Description = entity.Description;
            group.IsActive    = entity.IsActive;
            group.SortId      = entity.SortId;

            _unitOfWork.Group.Update(group);

            if (_unitOfWork.Complete() > 0)
            {
                return(true);
            }

            return(false);
        }