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)); }
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()); }
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)); }
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); } }
public async Task <AccountUpdateDTO> UpdateAccountInformation(AccountUpdateDTO model) { var user = await client.GetResponseObject <AccountUpdateDTO, AccountUpdateDTO>(string.Format("updateaccountinformation"), eHttpMethodType.PUT, model); return(user); }