public ActionResult Create() { EntryRecordCreateViewModel erc = new EntryRecordCreateViewModel(); erc.listaStudenata = ctx.Student.ToList(); return(View("Create", erc)); }
public ActionResult Create(int studentId, int kolicina) { if (!ModelState.IsValid) { EntryRecordCreateViewModel erc = new EntryRecordCreateViewModel(); erc.listaStudenata = ctx.Student.ToList(); return(View("Create", erc)); } else { EvidencijaPrijava pr = new EvidencijaPrijava(); pr.Kolicina = kolicina; pr.StudentId = studentId; pr.RadnikId = Autentifikacija.GetLogiraniKorisnik(HttpContext).Id; ctx.EvidencijaPrijava.Add(pr); ctx.SaveChanges(); } return(RedirectToAction("Index")); }