Exemplo n.º 1
0
 public ActionResult AddOrEdit(Film film)
 {
     using (BioskopEnti2 db = new BioskopEnti2())
     {
         if (film.IDFilm == 0)
         {
             db.Films.Add(film);
             db.SaveChanges();
             return(Json(new { success = true, message = "Uspesno Sacuvano" }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             db.Entry(film).State = EntityState.Modified;
             db.SaveChanges();
             return(Json(new { success = true, message = "Uspesno izmenjeno!" }, JsonRequestBehavior.AllowGet));
         }
     }
 }
 public ActionResult AddOrEditClan(Clanstvo clanstvo)
 {
     using (BioskopEnti2 db = new BioskopEnti2())
     {
         if (clanstvo.IDClan == 0)
         {
             db.Clanstvoes.Add(clanstvo);
             db.SaveChanges();
             return(Json(new { success = true, message = "Uspesno Sacuvano" }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             db.Entry(clanstvo).State = EntityState.Modified;
             db.SaveChanges();
             return(Json(new { success = true, message = "Uspesno izmenjeno!" }, JsonRequestBehavior.AllowGet));
         }
     }
 }
 public ActionResult AddOrEditRez(Rezervacija reze)
 {
     using (BioskopEnti2 db = new BioskopEnti2())
     {
         if (reze.IDRez == 0)
         {
             db.Rezervacijas.Add(reze);
             db.SaveChanges();
             return(Json(new { success = true, message = "Uspesno Sacuvano" }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             db.Entry(reze).State = EntityState.Modified;
             db.SaveChanges();
             return(Json(new { success = true, message = "Uspesno izmenjeno!" }, JsonRequestBehavior.AllowGet));
         }
     }
 }