예제 #1
0
 public ActionResult Create(quanlichitieu model)
 {
     validateBound(model);
     if (ModelState.IsValid)
     {
         model.date = DateTime.Now;
         db.quanlichitieux.Add(model);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
        public ActionResult Create(Expend expend)
        {
            if (expend.Amount < 1)
            {
                ModelState.AddModelError("Amount", "Số tiền quá ít!");
            }
            if (ModelState.IsValid)
            {
                expend.Date = DateTime.Now;
                db.Expends.Add(expend);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(expend));
        }