public ActionResult AddItems2(PomiarItems2ViewModel vm2) { context.Items.Add(vm2.Items); context.SaveChanges(); return(RedirectToAction("Details", "Pomiar", new { id = vm2.Items.PomiarId })); }
public ActionResult EditItem2(PomiarItems2ViewModel pm2) { Items items = new Items(); items = pm2.Items; if (items != null) { context.Entry(items).State = EntityState.Modified; context.SaveChanges(); return(RedirectToAction("Details", new { id = pm2.Items.PomiarId })); } else { return(View(items)); } }
// get / edycja produktu - generowane na podstawie id klienta oraz id produktu public ActionResult EditItem2(int?id, int?id2) { Items data = context.Items.FirstOrDefault(c => c.ItemsId == id); if (data == null) { return(HttpNotFound()); } Pomiar dataPomiar = context.Pomiars.FirstOrDefault(x => x.PomiarId == id2); if (dataPomiar == null) { return(HttpNotFound()); } PomiarItems2ViewModel vm4 = new PomiarItems2ViewModel(); vm4.Items = data; vm4.Pomiar = dataPomiar; return(PartialView("_EditItem", vm4)); }