public ActionResult Edit(IzvrsenaUsluga vm) { IzvrseneUsluge a = new IzvrseneUsluge(); if (ModelState.IsValid) { a = db.IzvrseneUslugee.Find(vm.Id); a.Id = vm.Id; a.RacuniId = vm.RacuniId; a.UslugeId = vm.UslugeId; a.IsDeleted = false; db.SaveChanges(); TempData["Message"] = "Uspješna izmjena!"; return(RedirectToAction("Edit")); } vm.listaRacuna = db.Racunii.ToList(); vm.listaUsluga = db.Uslugee.ToList(); return(View(vm)); }
public ActionResult Create(IzvrsenaUsluga vm) { IzvrseneUsluge p = new IzvrseneUsluge(); if (ModelState.IsValid) { p.Id = vm.Id; p.RacuniId = vm.RacuniId; p.UslugeId = vm.UslugeId; p.IsDeleted = false; db.IzvrseneUslugee.Add(p); db.SaveChanges(); TempData["Message"] = "Uspješno dodavanje!"; return(RedirectToAction("Create")); } vm.listaRacuna = db.Racunii.ToList(); vm.listaUsluga = db.Uslugee.ToList(); return(View(vm)); }