Beispiel #1
0
 private void validateBound(quanlichitieu model)
 {
     if (model.amount <= 0)
     {
         ModelState.AddModelError("amount", "Không hop le");
     }
 }
Beispiel #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            quanlichitieu quanlichitieu = db.quanlichitieux.Find(id);

            db.quanlichitieux.Remove(quanlichitieu);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #3
0
 public ActionResult Edit(quanlichitieu model)
 {
     validateBound(model);
     if (ModelState.IsValid)
     {
         db.Entry(model).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
Beispiel #4
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));
 }
Beispiel #5
0
        // GET: /Chitieu/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            quanlichitieu quanlichitieu = db.quanlichitieux.Find(id);

            if (quanlichitieu == null)
            {
                return(HttpNotFound());
            }
            return(View(quanlichitieu));
        }