public void Save(int propertyId, AccountDto accountToSave) { var property = _propertyRepository.Get(propertyId); var account = new Account(accountToSave.Name, property); if (accountToSave.Id != 0) _accountRepository.Update(account, accountToSave.Id); else _accountRepository.Add(account); }
public ActionResult Save(AccountDto accountToSave) { _accountApp.Save(SeletedPropertyId, accountToSave); return RedirectToAction("Index"); }
public ActionResult SaveAccount(AccountDto accountToSave) { var login = Request.Headers["login"]; var token = Request.Headers["token"]; var propertyId = Convert.ToInt32(Request.Headers["propertyId"]); if (!ValidatePost(login, token, propertyId)) return Json("usuário inválido", JsonRequestBehavior.AllowGet); var accountApp = new AccountApp(_accountRepository, _propertyRepository, _transactionRepository); accountApp.Save(propertyId, accountToSave); return Json("OK"); }