public ActionResult ASPEdit(BranchGatewayProtocol collection) { try { if (ViewData.ModelState.IsValid == false) ViewData.ModelState.AddModelError("", "Review Form"); else { MaintenanceDao.SaveBranchGatewayProtocol(collection); } return View(); } catch { return View(); } }
public ActionResult Create(BranchGatewayProtocol collection) { try { if (ViewData.ModelState.IsValid == false) ViewData.ModelState.AddModelError("", "Review Form"); else { MaintenanceDao.SaveBranchGatewayProtocol(collection); ViewData.ModelState.Clear(); return View("Edit", new BranchGatewayProtocol { id = 0 }); } return View("Edit"); } catch { return View(); } }
public static void SaveBranchGatewayProtocol(BranchGatewayProtocol change) { using (GatewayDbContext ctx = new GatewayDbContext()) { if (change.id > 0) { BranchGatewayProtocol orig = ctx.BranchGatewayProtocols.Single(o => o.id == change.id); orig.Branch = change.Branch; orig.ClientApplicationName = change.ClientApplicationName; orig.FinancialInstitution = change.FinancialInstitution; orig.GatewayId = change.GatewayId; orig.Protocol = change.Protocol; orig.SourceType = change.SourceType; orig.SubOffice = change.SubOffice; } else { ctx.BranchGatewayProtocols.InsertOnSubmit(change); } ctx.SubmitChanges(); } }