public ActionResult Lines_EditData(DXInfo.Models.Line line) { var gridModel = new LinesGridModel(); SetupLinesGridModel(gridModel.LinesGrid); if (gridModel.LinesGrid.AjaxCallBackMode == AjaxCallBackMode.AddRow) { using (var context = db) { line.Id = Guid.NewGuid(); context.Lines.Add(line); context.SaveChanges(); } } if (gridModel.LinesGrid.AjaxCallBackMode == AjaxCallBackMode.EditRow) { using (var context = db) { var oldline = context.Lines.Where(w => w.Id == line.Id).FirstOrDefault(); oldline.Code = line.Code; oldline.Name = line.Name; oldline.Comment = line.Comment; oldline.Mileage = line.Mileage; context.SaveChanges(); } } return(RedirectToAction("Lines")); }
public ActionResult Lines() { var gridModel = new LinesGridModel(); SetupLinesGridModel(gridModel.LinesGrid); return(View(gridModel)); }
public ActionResult Lines_RequestData() { var gridModel = new LinesGridModel(); SetupLinesGridModel(gridModel.LinesGrid); var lines = db.Lines.ToList(); return(gridModel.LinesGrid.DataBind(lines.AsQueryable())); }