public ActionResult AddCpu() { var cp = new CpuRepo(new CpuMssql()); var cvm = new CpuViewModel((Computer)Session["CurrentBuild"], cp.GetAll()); return(View(cvm)); }
// GET: Part public ActionResult Cpu(int computerId) { var cr = new ComputerRepo(new ComputerMssql()); var cp = new CpuRepo(new CpuMssql()); var cvm = new CpuViewModel(cr.GetById(computerId), cp.GetAll()); return(View(cvm)); }
public ActionResult AddCpu(int cpuId) { var cp = new CpuRepo(new CpuMssql()); var pc = (Computer)Session["CurrentBuild"]; pc.Cpu = cp.GetById(cpuId); Session["CurrentBuild"] = pc; return(RedirectToAction("NewBuild", "Build")); }
public ActionResult EditCpu(int computerId, int cpuId) { var cr = new ComputerRepo(new ComputerMssql()); var cp = new CpuRepo(new CpuMssql()); var editedPc = cr.GetById(computerId); editedPc.Cpu = cp.GetById(cpuId); cr.Update(editedPc); return(RedirectToAction("EditBuild", "Build", new { computerId })); }