Ejemplo n.º 1
0
 public Achievement Achievement_Delete(Achievement obj)
 {
     Achievement achievement = db.Achievements.SingleOrDefault(o => o.ID == obj.ID);
     db.Achievements.Remove(achievement);
     db.SaveChanges();
     return achievement;
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 public ActionResult DeleteConfirmed(Achievement achievement)
 {
     dm.Achievement_Delete(achievement);
     return RedirectToAction("Index");
 }