public ActionResult ChangeCPU(cCPU cpu, int?quantity, string image) { CRUDService.ServiceClient sr = new CRUDService.ServiceClient(); PartsStock part = new PartsStock(); if (quantity != null) { part.Quantity = (int)quantity; } else { part.Quantity = sr.getPart(cpu.id).Quantity; } if (image != null && image != "") { part.Image = image; } else { part.Image = sr.getPart(cpu.id).image; } bool done = sr.EditCPU(cpu, part, cpu.id); if (done) { return(this.Redirect(Url.Action("Complete", "EditProduct"))); } else { return(this.Redirect(Url.Action("CPU", "EditProduct"))); } }
public ActionResult CPU(int id) { CRUDService.ServiceClient sr = new CRUDService.ServiceClient(); cCPU part = sr.getCPU(id); return(View(part)); }
public ActionResult CPU() { if (Convert.ToInt32(Session["UserType"]) != 1 && Convert.ToInt32(Session["UserType"]) != 3) { return(this.Redirect(@Url.Action("Index", "Home"))); } cCPU part = new cCPU { active = 0 }; return(View(part)); }
public ActionResult addCPU(cCPU part, string image) { if (Convert.ToInt32(Session["UserType"]) != 1 && Convert.ToInt32(Session["UserType"]) != 3) { return(this.Redirect(@Url.Action("Index", "Home"))); } CRUDService.ServiceClient sr = new CRUDService.ServiceClient(); bool added = sr.addCPU(part, 1, image); if (added) { return(this.Redirect(Url.Action("Complete", "AddNewProduct"))); } else { return(this.Redirect(Url.Action("CPU", "AddNewProduct"))); } }