public ActionResult OrderCreate(Reparaty tempReparaty) { tempReparaty.KlantID = int.Parse(Request.Form["Klantenid"]); tempReparaty.MedewerkerID = int.Parse(Request.Form["Medewerkerid"]); tempReparaty.Arbeidsloon = 0; db.Reparaties.Add(tempReparaty); db.SaveChanges(); return(RedirectToAction("Index", "Home")); }
public ActionResult OrderEdit(Reparaty tempReparaty) { var entity = db.Reparaties.SingleOrDefault(Reparatie => Reparatie.Id == tempReparaty.Id); tempReparaty.MedewerkerID = int.Parse(Request.Form["MedewerkeridEdit"]); //Krijg medewerker id van OrderEdit view decimal tempLoon = 0; bool success = decimal.TryParse(Request.Form["ArbeidsLoonbox"].Replace('.', ','), out tempLoon); //Krijg loon van OrderEdit view entity.Arbeidsloon = success ? tempLoon : 0; entity.Beschrijving = tempReparaty.Beschrijving; entity.Gebruikts = tempReparaty.Gebruikts; entity.Procedure = tempReparaty.Procedure; entity.Status = tempReparaty.Status; entity.Titel = tempReparaty.Titel; entity.MedewerkerID = tempReparaty.MedewerkerID; db.Entry(entity).State = EntityState.Modified;//Zet entry state naar modified zodat de entry wordt geupdate db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public ActionResult OrderDelete(int id)//Order Delete returnt 1 reparatie naar delete view voor bevesteging { Reparaty tempReparatie = db.Reparaties.Where(e => e.Id == id).FirstOrDefault(); return(View(tempReparatie)); }
public ActionResult OrderDetails(int id)//Order Details returnt 1 reparatie naar detail view { Reparaty tempReparatie = db.Reparaties.Where(e => e.Id == id).FirstOrDefault(); return(View(tempReparatie)); }
public ActionResult OrderEdit(int?id) //Order Edit edits order returnt 1 reparatie naar edit view { Reparaty tempReparatie = db.Reparaties.Where(e => e.Id == id).FirstOrDefault(); return(View(tempReparatie)); }
public ActionResult OrderDelete(Reparaty tempReparaty)//Verwijder order uit lijst nadat bevesteging is gegeven { db.Reparaties.Remove(db.Reparaties.Where(e => e.Id == tempReparaty.Id).First()); db.SaveChanges(); return(RedirectToAction("Index")); }