public ActionResult Create(OrderPO form) { ActionResult oResponse = RedirectToAction("Index", "Game"); if (ModelState.IsValid) { try { form.UserID = (Int64)Session["UserID"]; OrdersDO dataObject = OrderMapper.MapPoToDo(form); dataAccess.CreateNewOrder(dataObject, Session["Cart"] as List <int>); TempData["Message"] = $"{form.Name} order has been created"; } catch (Exception ex) { oResponse = View(form); } } else { oResponse = View(form); } Session["Cart"] = null; return(oResponse); }
public ActionResult UpdateOrder(Order form) { ActionResult respose; try { if (ModelState.IsValid) { //maps order po to order do OrderDO OrderDO = OrderMapper.MapPoToDo(form); //da call for orderdo _OrderDataAccess.UpdateOrder(OrderDO); respose = View(form); } else { respose = RedirectToAction("Login", "Account"); } } catch (SqlException sqlex) { _Logger.ErrorLog(MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, sqlex); respose = RedirectToAction("Index", "Home"); } catch (Exception ex) { _Logger.ErrorLog(MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, ex); respose = RedirectToAction("Index", "Home"); } return(respose); }
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); }