public ActionResult AddMotherboard() { var rp = new MotherboardRepo(new MotherboardMssql()); var cvm = new MotherboardViewModel((Computer)Session["CurrentBuild"], rp.GetAll()); return(View(cvm)); }
public ActionResult Motherboard(int computerId) { var cr = new ComputerRepo(new ComputerMssql()); var mb = new MotherboardRepo(new MotherboardMssql()); var mvm = new MotherboardViewModel(cr.GetById(computerId), mb.GetAll()); return(View(mvm)); }
public JsonResult Delete(MotherboardViewModel motherboardModel) { try { _genericService.Delete(motherboardModel.ID); return(Json(new { Result = "OK" })); } catch (Exception ex) { return(Json(new { Result = "ERROR", Message = ex.Message })); } }
public JsonResult Edit(MotherboardViewModel motherboardModel) { try { _genericService.Update(_mapper.Map <MotherboardViewModel, MotherboardDTO>(motherboardModel)); return(Json(new { Result = "OK", Record = motherboardModel })); } catch (Exception ex) { return(Json(new { Result = "ERROR", Message = ex.Message })); } }
public JsonResult Create(MotherboardViewModel motherboardModel) { try { var id = _genericService.Save(_mapper.Map <MotherboardViewModel, MotherboardDTO>(motherboardModel)); motherboardModel.ID = id; return(Json(new { Result = "OK", Record = motherboardModel })); } catch (Exception ex) { return(Json(new { Result = "ERROR", Message = ex.Message })); } }