/// <summary> /// Get the cradit card and debit cards entry /// </summary> public ActionResult Index(cGet_Items Obj) //Getting there buying order id and quantity { // Creating cradit details object CraditDetails model = new CraditDetails(); // assigning values cradit details object model.OrderItemId = Obj.ItemID; model.OrderQuantity = Convert.ToInt32(Obj.Quantity); // returning cradit details view return(View(model)); }
/// <summary> /// Edit the selected item /// </summary> public ActionResult Edit(int Id) { if (Session["user"] != null) { cGet_Items _Items = DB.sp_Get_Items().Where(x => x.ItemID == Id).FirstOrDefault(); LoadDDL(); return(View(_Items)); } else { ViewBag.ErrorEx = "Session is expired."; return(View("Error")); } }
/// <summary> /// Get the selected item to order /// </summary> public ActionResult Display(int Id) { try { if (Session["user"] != null) { cGet_Items _Get_Items = DB.sp_Get_Items().Where(x => x.ItemID == Id).FirstOrDefault(); return(View(_Get_Items)); } else { ViewBag.ErrorEx = "Session is expired."; return(View("Error")); } } catch (Exception ex) { ViewBag.ErrorEx = ex.Message; return(View("Error")); } }
public ActionResult Edit(cGet_Items Obj, HttpPostedFileBase file) { try { if (Session["user"] != null) { // set file path string is empty string Filepath = string.Empty; if (file != null) { // append file name to obj image url Obj.ImageURL = file.FileName; //get server path and set path to save location Filepath = Path.Combine(Server.MapPath("~/Images/Items/"), Obj.ImageURL); //save file file.SaveAs(Filepath); } else { Obj.ImageURL = DB.Items.Where(x => x.ItemID == Obj.ItemID && x.IsDeleted == false && x.IsActive == true).Select(x => x.ImageURL).FirstOrDefault(); } //save items in db DB.sp_SaveItems(Obj.BrandID, Obj.CategoryID, Obj.ItemName, Obj.ItemDesc, Obj.ImageURL, Obj.Price, Obj.Quantity, 1, Obj.ItemID); LoadDDL(); ViewBag.sucMsg = "Item created success."; cGet_Items _Items = DB.sp_Get_Items().Where(x => x.ItemID == Obj.ItemID).FirstOrDefault(); return(View(_Items)); } else { ViewBag.ErrorEx = "Session is expired."; return(View("Error")); } } catch (Exception ex) { ViewBag.ErrorEx = ex.Message; return(View("Error")); } }