Пример #1
0
        public ActionResult Create(Causale oCausale)
        {
            if (oCausale == null)
                oCausale = new Causale();

            return View(oCausale);
        }
Пример #2
0
        public ActionResult Edit(Causale oCausale)
        {
            //if (oCausale == null)
            //    oCausale = new Causale();
            //else
            Causale model =_oCausaleRepo.GetEdit().SingleOrDefault(x => x.ID == oCausale.ID);

            return View(model);
        }
Пример #3
0
        public ActionResult Delete(Causale model)
        {
            if (model != null && ModelState.IsValid)
            {
                // Aggiorno l'operazione
                Causale oCausale = _oCausaleRepo.GetEdit().SingleOrDefault(x => x.ID == model.ID);
                if (oCausale != null)
                    _oCausaleRepo.Delete(oCausale);

                this.DatabaseFactory.GetContext().SaveChanges();
                return RedirectToAction("Index");
            }
            return RedirectToAction("Index");
        }
Пример #4
0
 public ActionResult Insert(Causale oCausale)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _oCausaleRepo.Add(oCausale);
             this.DatabaseFactory.GetContext().SaveChanges();
             return RedirectToAction("Index");
             //return View("Index");
         }
         catch (Exception)
         {
             return RedirectToAction("Create", oCausale);
             //return View("Create", oCausale);
         }
     }
     //return View("Create", oCausale);
     return RedirectToAction("Create", oCausale);
 }
 public void Update(Causale oCausale)
 {
     _db.Remove(oCausale);
     _db.Add(oCausale);
 }
 public void Delete(Causale oCausale)
 {
     _db.Remove(oCausale);
 }
 public void Add(Causale oCausale)
 {
     _db.Add(oCausale);
 }