public ActionResult UpdateOrder(OrdersPO form) { ActionResult response; //checking modelstate if (ModelState.IsValid) { try { //mapping user inpit to database OrdersDO OrderDO = Mapper.OrdersPOtoOrdersDO(form); _OrdersDAO.UpdateOrder(OrderDO); response = RedirectToAction("ViewOrderByID", "Orders", new { OrderDO.OrderID }); } //logging errors and redirecting catch (SqlException sqlEx) { Logger.SqlErrorLog(sqlEx); response = View("Error"); } catch (Exception ex) { Logger.ErrorLog(ex); response = View("Error"); } } else { //returning to form view if model state is invalid response = View(form); } //return view return(response); }
public ActionResult UpdateOrder(Order form) { ActionResult response; if (ModelState.IsValid) { OrderDO orderDO = orderMapper.MappPoToDO(form); ordersDAO.UpdateOrder(orderDO); response = RedirectToAction("ViewOrders", "Order"); } else { response = View(form); } return(response); }
public ActionResult UpdateOrder(OrderPO form) { ActionResult oReponse = RedirectToAction("Index", "Order"); if (ModelState.IsValid) { try { form.UserID = (Int64)Session["UserID"]; OrdersDO dataObject = OrderMapper.MapPoToDo(form); dataAccess.UpdateOrder(dataObject); } catch (Exception ex) { oReponse = View(form); } } else { oReponse = View(form); } return(oReponse); }