public JsonResult BaseCategoryEdit(int BaseCatId, string BaseCatName, string BaseCatDescription) //updated values are passed as parameters of post function through ajax method { ShoppingCartDbEntities db = new ShoppingCartDbEntities(); BaseCategory_Table category = db.BaseCategory_Table.Find(BaseCatId); //Details of patricular base category to be edited is obtained using it's id category.BaseCatName = BaseCatName; category.BaseCatDesc = BaseCatDescription; category.BaseCatUpdatedBy = Session["user"].ToString(); category.BaseCatIsDeleted = false; category.BaseCatUpdateDate = DateTime.Now; db.SaveChanges(); var redirectUrl = new UrlHelper(Request.RequestContext).Action("ManageBaseCategories", "Admin"); //passing url to which control to be navigated is stored in a variable return(Json(new { BaseCatId = BaseCatId, BaseCatName = BaseCatName, BaseCatDesc = BaseCatDescription, Url = redirectUrl }, JsonRequestBehavior.AllowGet)); //Values updated and url is returned back to ajax success function }
public JsonResult ProductCategoryEdit(int ProductCatId, string ProductCatName, string ProductCatDescription) //updated values are passed as parameters of post function through ajax method { ShoppingCartDbEntities db = new ShoppingCartDbEntities(); ProductCategory_Table category = db.ProductCategory_Table.Find(ProductCatId); //Details of patricular product category to be edited is obtained using it's id var emp = (from u in db.ProductCategory_Table //Base Category Id of product category to be edited is found where ProductCatId == u.ProductCatId select u.BaseCatid).FirstOrDefault(); category.BaseCatid = emp; category.ProductCatName = ProductCatName; category.ProductCatDesc = ProductCatDescription; category.ProductCatUpdatedDate = DateTime.Now; category.ProductCateUpdatedBy = Session["user"].ToString(); category.ProductCatIsDeleted = false; db.SaveChanges(); var redirectUrl = new UrlHelper(Request.RequestContext).Action("ManageProductCategories", "Admin"); //passing url to which control to be navigated is stored in a variable return(Json(new { ProductCatId = ProductCatId, ProductCatName = ProductCatName, ProductCatDesc = ProductCatDescription, Url = redirectUrl }, JsonRequestBehavior.AllowGet)); //Values updated and url is returned back to ajax success function }
public void DisableNotification() { Order_Table obj = new Order_Table(); var order = (from a in db.Order_Table where a.OrderIsDeleted == false select a).ToList(); foreach (var item in order) { if (item.OrderNotification == "00") { item.OrderNotification = "10"; } else if (item.OrderNotification == "01") { item.OrderNotification = "11"; } } db.SaveChanges(); }
/// <summary> /// For disabling notification number in navigation bar after seen by the user /// </summary> public void DisableNotification() { Order_Table obj = new Order_Table(); var order = (from a in db.Order_Table select a).ToList(); foreach (var item in order) { if (item.OrderNotification == "00") //notification satus=00,when new order is placed { item.OrderNotification = "01"; //changing status to 01, indicating service provider has seen the notification } else if (item.OrderNotification == "10") //notification satus = 10, when new order is seen by seller but not service provider { item.OrderNotification = "11"; //changing status to 11, indicating both seller and service provider has seen the notification } } db.SaveChanges(); Notification_Count(); }
public ActionResult profile(User_Table obj) { if (obj.FirstName != null && obj.LastName != null && obj.UserEmail != null && obj.UserAddress != null && obj.UserPhno != null) { string name = Session["user"].ToString(); User_Table user = db.User_Table.Where(x => x.UserName == name).FirstOrDefault(); user.FirstName = obj.FirstName; user.LastName = obj.LastName; user.UserEmail = obj.UserEmail; user.UserAddress = obj.UserAddress; user.UserPhno = obj.UserPhno; user.UserUpdatedDate = System.DateTime.Now; db.SaveChanges(); } else { TempData["fill_msg"] = "Please Enter The Details"; return(RedirectToAction("profile")); } return(View()); }
public ActionResult Create(Image_Table model, Product_Table product) { int j; Notification_Count(); Image_Table image = new Image_Table(); if (ModelState.IsValid) { ShoppingCartDbEntities db = new ShoppingCartDbEntities(); string name = Session["user"].ToString(); int id = (from user in db.User_Table where user.UserName == name select user.UserId).FirstOrDefault(); product.SellerId = id; product.ProductCreatedBy = Session["user"].ToString(); product.ProductCreatedDate = DateTime.Now; product.ProductUpdatedBy = Session["user"].ToString(); product.ProductUpdatedDate = DateTime.Now; product.ProductIsDeleted = false; db.Product_Table.Add(product); db.SaveChanges(); object[] imgarray = new object[5]; int p = product.ProductId; HttpPostedFileBase file = Request.Files["ImageData"]; for (j = 0; j < Request.Files.Count; j++) { file = Request.Files[j]; ContentRepository service = new ContentRepository(); if (file.FileName != "") { image = service.UploadImageInDataBase(file, model); Image_Table imageObj = new Image_Table(); imageObj.BinaryImage = image.BinaryImage; imageObj.Productid = product.ProductId; imageObj.ImageCreatedBy = Session["user"].ToString(); imageObj.ImageCreatedDate = DateTime.Now; imageObj.ImageUpdatedBy = Session["user"].ToString(); imageObj.ImageUpdatedDate = DateTime.Now; imageObj.ImageIsDeleted = false; db.Image_Table.Add(imageObj); db.SaveChanges(); } else if (file.FileName == "") { TempData["null_image"] = "Cannot Upload Null Image"; return(RedirectToAction("Create")); } else { TempData["not_image"] = "this is not an image file"; return(RedirectToAction("Create")); } } } return(RedirectToAction("display")); }