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

                return(Ok());
            }
            catch (System.Exception e)
            {
                return(HandleException(e));
            }
        }
Esempio n. 2
0
        public async Task <bool> Update(int id, ClientToEditDto entity)
        {
            var Client = await this._unitOfWork.Client.Get(id);

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

            Client.IsActive   = entity.IsActive;
            Client.BusinessId = entity.BusinessId;

            _unitOfWork.Client.Update(Client);

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

            return(false);
        }