public ActionResult Edit(int id, Route route) { try { if (routeDAO.GetHultById(id).Count >= 5) { if (routeDAO.UpdateRoute(id, route.ApprovedStatus)) { return(RedirectToAction("IndexDirector")); } else { return(View("Edit")); } } else { return(View("ErrorNumber")); } } catch { return(View("Edit")); } }
//update protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { string routeID = GridView1.DataKeys[e.RowIndex].Value.ToString(); GridViewRow row = GridView1.Rows[e.RowIndex]; TextBox duration = (TextBox)row.Cells[2].Controls[0]; GridView1.EditIndex = -1; //update data RouteDAO.UpdateRoute(routeID, Convert.ToInt32(duration.Text)); ShowDataRoute(); }
public ActionResult Edit(int id, Route contact) { if ((id > 0) && (contact != null) && (ModelState.IsValid)) { Rdao.UpdateRoute(contact); return(RedirectToAction("Index")); } else { return(View("Edit")); } }
public ActionResult RouteEdit(Route updateR) { if (ModelState.IsValid) { var editResult = RouteDAO.UpdateRoute(updateR); if (editResult == "ok") { return(RedirectToAction("Route")); } ModelState.AddModelError("", editResult); } return(View()); }