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)); }
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()); } }
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()); } }