Beispiel #1
0
        //Get
        public ActionResult Edit(Guid?Id)
        {
            if (Id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var account = _accountSvc.getSingalAccountData(Id.Value);

            if (account == null)
            {
                return(HttpNotFound());
            }

            MyAccountViewModels accountObj = null;

            if (account != null)
            {
                accountObj = new MyAccountViewModels
                {
                    category = account.Categoryyy == 0 ? "支出" : "收入",
                    date     = account.Dateee,
                    memo     = account.Remarkkk,
                    myMoney  = account.Amounttt
                };
            }
            return(View(accountObj));
        }
Beispiel #2
0
        public ActionResult Detail(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var accountData = _accountSvc.getSingalAccountData(id.Value);

            if (accountData == null)
            {
                return(HttpNotFound());
            }
            ;

            MyAccountViewModels accountObj = new MyAccountViewModels
            {
                ID       = accountData.Id,
                category = accountData.Categoryyy == 0 ? "支出" : "收入",
                date     = accountData.Dateee,
                memo     = accountData.Remarkkk,
                myMoney  = accountData.Amounttt
            };

            return(View(accountObj));
        }
Beispiel #3
0
 public void editAccountData(MyAccountViewModels modifyAccountData, AccountBook accountData)
 {
     accountData.Amounttt   = decimal.ToInt32(modifyAccountData.myMoney);
     accountData.Categoryyy = modifyAccountData.category == "支出" ? 0 : 1;
     accountData.Dateee     = modifyAccountData.date;
     accountData.Remarkkk   = modifyAccountData.memo;
 }
        // GET: Manager/MyAccountViewModels/Details/5
        public ActionResult Details(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var accountBook = _accountService.getSingalAccountData(id.Value);

            if (accountBook == null)
            {
                return(HttpNotFound());
            }

            MyAccountViewModels myAccountViewModels = new MyAccountViewModels
            {
                ID       = accountBook.Id,
                category = accountBook.Categoryyy == 0 ? "支出" : "收入",
                date     = accountBook.Dateee,
                myMoney  = accountBook.Amounttt,
                memo     = accountBook.Remarkkk
            };

            return(View(myAccountViewModels));
        }
Beispiel #5
0
        public ActionResult Edit([Bind(Include = "ID,category,myMoney,date,memo")] MyAccountViewModels accountObj)
        {
            var editAccount = _accountSvc.getSingalAccountData(accountObj.ID);

            if (editAccount != null && ModelState.IsValid)
            {
                _accountSvc.editAccountData(accountObj, editAccount);
                _accountSvc.save();
                return(RedirectToAction("myAccountBook"));
            }
            return(View(accountObj));
        }
        public ActionResult Edit([Bind(Include = "ID,category,myMoney,date,memo")] MyAccountViewModels myAccountViewModels)
        {
            var editAccount = _accountService.getSingalAccountData(myAccountViewModels.ID);

            if (editAccount != null && ModelState.IsValid)
            {
                _accountService.editAccountData(myAccountViewModels, editAccount);
                _accountService.save();
                return(RedirectToAction("Index"));
            }
            return(View(myAccountViewModels));
        }
Beispiel #7
0
 public ActionResult ajaxPostAccount([Bind(Include = "category,myMoney,date,memo")] MyAccountViewModels accountObj)
 {
     if (ModelState.IsValid)
     {
         AccountBook newbookData = new AccountBook
         {
             Id         = Guid.NewGuid(),
             Categoryyy = accountObj.category == "支出" ? 0 : 1,
             Amounttt   = decimal.ToInt32(accountObj.myMoney),
             Dateee     = accountObj.date,
             Remarkkk   = accountObj.memo
         };
         _accountSvc.addAccountData(newbookData);
         _accountSvc.save();
         //context.AccountBook.Add(newbookData);
         //context.SaveChanges();
     }
     return(PartialView("_ajaxPostAccount", paging(1)));
 }
        public ActionResult Create([Bind(Include = "category,myMoney,date,memo")] MyAccountViewModels myAccountViewModels)
        {
            if (ModelState.IsValid)
            {
                AccountBook account = new AccountBook
                {
                    Id         = Guid.NewGuid(),
                    Categoryyy = myAccountViewModels.category == "支出" ? 0 : 1,
                    Amounttt   = decimal.ToInt32(myAccountViewModels.myMoney),
                    Dateee     = myAccountViewModels.date,
                    Remarkkk   = myAccountViewModels.memo
                };
                myAccountViewModels.ID = Guid.NewGuid();
                _accountService.addAccountData(account);
                _accountService.save();
                return(RedirectToAction("Index"));
            }

            return(View(myAccountViewModels));
        }