public Achievement Achievement_Delete(Achievement obj) { Achievement achievement = db.Achievements.SingleOrDefault(o => o.ID == obj.ID); db.Achievements.Remove(achievement); db.SaveChanges(); return achievement; }
public Achievement Achievement_Edit(Achievement obj) { db.Entry(obj).State = EntityState.Modified; db.SaveChanges(); obj = db.Achievements.SingleOrDefault(o => o.ID == obj.ID); return obj; }
public Achievement Achievement_Create(Achievement obj) { obj.ID = Guid.NewGuid(); db.Achievements.Add(obj); db.SaveChanges(); obj = db.Achievements.FirstOrDefault(o => o.ID == obj.ID); return obj; }
public ActionResult Create(Achievement achievement) { if (ModelState.IsValid) { achievement.ID = Guid.NewGuid(); dm.Achievement_Create(achievement); dm.Save(); return RedirectToAction("Index"); } ViewBag.Organisator_id = new SelectList(dm.Get_Organisator(), "ID", "Name", achievement.Organisator_id); ViewBag.Level_type_id = new SelectList(dm.Get_Level_Type(), "ID", "Name", achievement.Level_type_id); ViewBag.Achievement_type_id = new SelectList(dm.Get_Achievement_Type(), "ID", "Name", achievement.Achievement_type_id); return View(achievement); }
public ActionResult DeleteConfirmed(Achievement achievement) { dm.Achievement_Delete(achievement); return RedirectToAction("Index"); }