Ejemplo n.º 1
0
 public ActionResult Creat(MoneyViewModel moneyViewModel)
 {
     if (ModelState.IsValid)
     {
         moneyService.Add(moneyViewModel);
         moneyService.Save();
         return(RedirectToAction("Index"));
     }
     return(View("Index", moneyViewModel));
 }
Ejemplo n.º 2
0
 public ActionResult MoneyInput(MoneyClass Input)
 {
     if (ModelState.IsValid)
     {
         _MoneyService.Add(Input);
         _MoneyService.Save();
         return(View());
     }
     return(View(Input));
 }
Ejemplo n.º 3
0
        public ActionResult Index([Bind(Include = "Categoryyy,Amounttt,Dateee,Remarkkk")]
                                  MyMoneyViewModel booking)
        {
            if (ModelState.IsValid)
            {
                _MoneyService.Add(booking);
                _MoneyService.Save();
            }

            return(View());
        }
Ejemplo n.º 4
0
        public ActionResult Index([Bind(Include = "Type,Date,Price,Description")]
                                  MoneyViewModel model)
        {
            /***不知道為什麼model裡面的Type都是None???***/
            if (ModelState.IsValid)
            {
                _imoneyService.Add(model);
                _unitOfWork.Commit();
                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
Ejemplo n.º 5
0
        public ActionResult Index([Bind(Include = "Type,Date,Price,Description")]
                                  MoneyViewModel model)
        {
            ViewData["CategoryItems"] = GetCategoryList();
            ViewData["PageItems"]     = GetPageDropDownList();
            /***不知道為什麼model裡面的Type都是None???***/
            if (ModelState.IsValid)
            {
                _imoneyService.Add(model);
                _unitOfWork.Commit();
                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
Ejemplo n.º 6
0
        public ActionResult Add([Bind(Include = "Category,Amount,BillingDate,Memo")] MoneyAddViewModels MoneyAdd)
        {
            ViewData["CategoryList"] = new SelectList(DataDict.Category, "key", "value");

            if (ModelState.IsValid)
            {
                _MoneyService.Add(MoneyAdd);
                _LogService.Add(MoneyAdd.Category, MoneyAdd.Amount, "Add");
                _MoneyService.Save();

                //System.Threading.Thread.Sleep(3000);    //測試ajax
                //return View();
                return(PartialView("List", _MoneyService.GetDataEF())); //加入ajax
            }

            return(View());
        }
Ejemplo n.º 7
0
 private Money Add(Money m1, Money m2)
 {
     return(MoneyService.Add(m1, m2));
 }