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

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

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

            entityToUpdate.Description = entity.Description;
            entityToUpdate.IsActive    = entity.IsActive;
            entityToUpdate.Order       = entity.Order;
            entityToUpdate.GroupId     = entity.GroupId;

            _unitOfWork.AccountType.Update(entityToUpdate);

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

            return(false);
        }