Exemplo n.º 1
0
        public async Task <IActionResult> Patch(int id, AccountToEditDto AccountDto)
        {
            try
            {
                if (!await _serviceManager.Account.Update(id, AccountDto))
                {
                    return(BadRequest());
                }

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

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

            //AddHistory(account);

            account.Address1       = entity.Address1;
            account.Address2       = entity.Address2;
            account.AccountNo      = entity.AccountNo;
            account.ZipCode        = entity.ZipCode;
            account.State          = entity.State;
            account.AccountTypeId  = entity.AccountTypeId;
            account.ClientId       = entity.ClientId;
            account.Email          = entity.Email;
            account.FirstName      = entity.FirstName;
            account.IsMain         = entity.IsMain;
            account.LastName       = entity.LastName;
            account.MiddleName     = entity.MiddleName;
            account.RelationshipId = entity.RelationshipId;
            account.Phone          = entity.Phone;
            account.SortId         = entity.SortId;
            account.IsActive       = entity.IsActive;

            _unitOfWork.Account.Update(account);

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

            return(false);
        }