public ActionResult Create([Bind(Include = "Nazwa,Logo")] StudioModels ownerModel) { if (ModelState.IsValid) { db.Studio.Add(ownerModel); db.SaveChanges(); //zapis zmian return(RedirectToAction("Index")); } return(View(ownerModel)); //zostaną dane w formularzu }
public ActionResult Create([Bind(Include = "Nazwa,Data_dolaczenia")] UzytkownicyModels ownerModel) { if (ModelState.IsValid) { db.Uzytkownik.Add(ownerModel); db.SaveChanges(); //zapis zmian return(RedirectToAction("Index")); } return(View(ownerModel)); //zostaną dane w formularzu }
public ActionResult Create([Bind(Include = "Tytul,Dlugosc,Plakat,Opis,GatunekID,StudioID")] FilmyModels ownerModel) { if (ModelState.IsValid) { db.Film.Add(ownerModel); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.GatunekID = new SelectList(db.Gatunek, "ID", "Nazwa", ownerModel.GatunekID); ViewBag.StudioID = new SelectList(db.Studio, "ID", "Nazwa", ownerModel.StudioID); return(View(ownerModel)); }
public ActionResult Index(int filmID) { WypozyczeniaModels wypozycz = new WypozyczeniaModels(); var username = User.Identity.GetUserName(); int userId = (from x in db.Uzytkownik where x.Nazwa == username select x.ID).SingleOrDefault(); string date = DateTime.Today.ToString("yyyy-MM-dd"); string tytul = (from x in db.Film where x.ID == filmID select x.Tytul).SingleOrDefault(); wypozycz.FilmID = filmID; wypozycz.Film_Tytul = tytul; wypozycz.UzytkownicyID = userId; wypozycz.Data = date; db.Wypozyczenia.Add(wypozycz); db.SaveChanges(); return(RedirectToAction("Moje_filmy")); }