示例#1
0
        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);
        }
示例#2
0
        public ActionResult Save(AccountDto accountToSave)
        {
            _accountApp.Save(SeletedPropertyId, accountToSave);

            return RedirectToAction("Index");
        }
示例#3
0
        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");
        }