public ActionResult AddOrEdit(Event eve)
 {
     using (ArtClubWebAppEntities db = new ArtClubWebAppEntities())
     {
         if (eve.EventID == 0)
         {
             db.Events.Add(eve);
             db.SaveChanges();
             return(Json(new { success = true, message = "Saved Successfully" }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             db.Entry(eve).State = EntityState.Modified;
             db.SaveChanges();
             return(Json(new { success = true, message = "Updated Successfully" }, JsonRequestBehavior.AllowGet));
         }
     }
 }
 public ActionResult Delete(int id)
 {
     using (ArtClubWebAppEntities db = new ArtClubWebAppEntities())
     {
         Event eve = db.Events.Where(x => x.EventID == id).FirstOrDefault <Event>();
         db.Events.Remove(eve);
         db.SaveChanges();
         return(Json(new { success = true, message = "Deleted Successfully" }, JsonRequestBehavior.AllowGet));
     }
 }
Exemplo n.º 3
0
 public ActionResult Delete(int id)
 {
     using (ArtClubWebAppEntities db = new ArtClubWebAppEntities())
     {
         Member mem = db.Members.Where(x => x.MemberID == id).FirstOrDefault <Member>();
         db.Members.Remove(mem);
         db.SaveChanges();
         return(Json(new { success = true, message = "Deleted Successfully" }, JsonRequestBehavior.AllowGet));
     }
 }