Exemplo n.º 1
0
        public async Task <ActionResult> UpdateAccountInformation(AccountUpdateDTO updatedto)
        {
            AccountUpdateDTO updated = null;

            if (ModelState.IsValid)
            {
                updated = await _accountservice.UpdateAccountInformation(updatedto);

                return(PartialView("AccountManagement", updated));
            }

            return(PartialView("AccountManagement", ModelState));
        }
Exemplo n.º 2
0
        public ActionResult UpdateAccount(int id, AccountUpdateDTO accountDTO)
        {
            var accountModel = _repository.GetAccountById(id);

            if (accountModel == null)
            {
                return(NotFound());
            }

            _mapper.Map(accountDTO, accountModel);
            _repository.UpdateAccount(accountModel);
            _repository.SaveChanges();

            return(NoContent());
        }
Exemplo n.º 3
0
 public IHttpActionResult UpdateAccountInformation([FromBody] AccountUpdateDTO viewmodel)
 {
     if (ModelState.IsValid)
     {
         var updated = _accountService.UpdateAccountInformation(viewmodel);
         if (updated != null)
         {
             return(Ok(updated));
         }
         else
         {
             return(BadRequest("Information blev ikke opdateret"));
         }
     }
     return(BadRequest(ModelState));
 }
Exemplo n.º 4
0
        public AccountUpdateDTO UpdateAccountInformation(AccountUpdateDTO viewmodel)
        {
            try
            {
                if (viewmodel.ID > 0)
                {
                    Account updatedacc = Mapper.Map <AccountUpdateDTO, Account>(viewmodel);

                    var currentaccount = _accountRepository.GetAccount(viewmodel.ID);
                    var updated        = _createAndUpdateService.UpdateAccountFields(currentaccount, updatedacc);
                    updated = _accountRepository.UpdateAccount(updated);
                    var accountviewmodel = Mapper.Map <Account, AccountUpdateDTO>(updated);

                    return(accountviewmodel);
                }
                return(null);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Exemplo n.º 5
0
        public async Task <AccountUpdateDTO> UpdateAccountInformation(AccountUpdateDTO model)
        {
            var user = await client.GetResponseObject <AccountUpdateDTO, AccountUpdateDTO>(string.Format("updateaccountinformation"), eHttpMethodType.PUT, model);

            return(user);
        }