Ejemplo n.º 1
0
        public ActionResult UpdateGenus(int id)
        {
            var     result = db.Genus.FirstOrDefault(x => x.ID == id);
            GenusVM genus  = new GenusVM();

            genus.Name = result.Name;
            return(View(genus));
        }
Ejemplo n.º 2
0
 public ActionResult UpdateGenus(GenusVM model)
 {
     if (ModelState.IsValid)
     {
         var result = db.Genus.FirstOrDefault(x => x.ID == model.ID);
         result.Name        = model.Name;
         ViewBag.islemDurum = 1;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     else
     {
         ViewBag.islemDurum = 2;
         return(View());
     }
 }
Ejemplo n.º 3
0
        public ActionResult AddGenus(GenusVM model)
        {
            if (ModelState.IsValid)
            {
                Genus genus = new Genus();
                genus.Name      = model.Name;
                genus.IsDeleted = false;

                db.Genus.Add(genus);
                db.SaveChanges();
                ViewBag.islemDurum = 1;
                return(View());
            }
            else
            {
                ViewBag.islemDurum = 2;
                return(View());
            }
        }