public ActionResult List() { ShopingContext spContext = new ShopingContext(); IEnumerable <category> categoryList = spContext.category.ToList(); return(View(categoryList)); }
private void getCountry() { ShopingContext shopingContext = new ShopingContext(); List <Country> countryList = shopingContext.country.ToList(); ViewBag.CountryList = new SelectList(countryList, "CountryId", "CountryName"); }
public ActionResult Index_Post(string id) { Product product = new Product(); TryUpdateModel(product); if (ModelState.IsValid) { product.p_IsActive = 1; ShopingContext shpContext = new ShopingContext(); if (string.IsNullOrEmpty(id)) { shpContext.product.Add(product); } else { product.Id = Convert.ToInt32(id); shpContext.Entry(product).State = System.Data.EntityState.Modified; } shpContext.SaveChanges(); } getBrand(); getCategory(); if (product.Id > 0) { return(RedirectToAction("Index", "Image", new { Id = product.Id })); } return(View()); }
public ActionResult Index_Post(string id) { Brand brand = new Brand(); TryUpdateModel(brand); if (ModelState.IsValid) { brand.b_IsActive = 1; ShopingContext shpContext = new ShopingContext(); if (string.IsNullOrEmpty(id)) { shpContext.brand.Add(brand); } else { brand.Id = Convert.ToInt32(id); shpContext.Entry(brand).State = System.Data.EntityState.Modified; } int i = shpContext.SaveChanges(); if (i == 1) { return(RedirectToAction("List")); } } return(View()); }
public ActionResult List() { ShopingContext shpContext = new ShopingContext(); IEnumerable <Brand> Brandist = shpContext.brand.ToList(); return(View(Brandist)); }
public JsonResult GetState(int country) { ShopingContext shopingContext = new ShopingContext(); List <states> statesList = shopingContext.states.Where(x => x.countryId == country).ToList(); return(Json(statesList)); }
public ActionResult List() { ShopingContext shpContext = new ShopingContext(); List <Product> pdct = shpContext.product.ToList(); return(View(pdct)); }
public ActionResult List() { ShopingContext shpContext = new ShopingContext(); List <Slider> slider = shpContext.HomeSlider.ToList(); return(View(slider)); }
public ActionResult Index() { ShopingContext SHC = new ShopingContext(); List <User> UserList = SHC.User.ToList(); return(View(UserList)); }
public JsonResult GetState(int country) { ShopingContext shopingContext = new ShopingContext(); List <states> statesList = shopingContext.states.Where(x => x.countryId == country).ToList(); ViewBag.States = new SelectList(statesList, "Id", "StateName"); return(Json(statesList)); }
public ActionResult Delete(int id) { ShopingContext shpContext = new ShopingContext(); Slider slider = shpContext.HomeSlider.Where(x => x.Id == id).FirstOrDefault(); shpContext.Entry(slider).State = System.Data.EntityState.Deleted; shpContext.SaveChanges(); return(RedirectToAction("List")); }
public ActionResult Delete(string id) { category cgt = new category(); ShopingContext shpContext = new ShopingContext(); cgt.Id = Convert.ToInt32(id); shpContext.Entry(cgt).State = System.Data.EntityState.Deleted; shpContext.SaveChanges(); return(RedirectToAction("List")); }
public ActionResult Delete(int id, int Iid) { ShopingContext shop = new ShopingContext(); UploadImage uimp = new UploadImage(); uimp.Id = Iid; shop.Entry(uimp).State = System.Data.EntityState.Deleted; shop.SaveChanges(); return(RedirectToAction("Index", new { id = id })); }
public ActionResult Index_Get(string id) { if (!string.IsNullOrEmpty(id)) { Brand brand = new Brand(); ShopingContext shpContext = new ShopingContext(); int Id = Convert.ToInt32(id); brand = shpContext.brand.Where(x => x.Id == Id).FirstOrDefault(); return(View(brand)); } return(View()); }
public ActionResult Index_Post() { Ecommerce.Areas.admin.Models.Attribute.Attribute attribute = new Ecommerce.Areas.admin.Models.Attribute.Attribute(); TryUpdateModel(attribute); if (ModelState.IsValid) { attribute.a_isActive = 1; ShopingContext shpContext = new ShopingContext(); shpContext.attribute.Add(attribute); shpContext.SaveChanges(); } return(View()); }
public ActionResult Index_Get(string id) { getBrand(); getCategory(); if (!string.IsNullOrEmpty(id)) { Product pr = new Product(); ShopingContext shpContext = new ShopingContext(); int Id = Convert.ToInt32(id); pr = shpContext.product.Where(x => x.Id == Id).FirstOrDefault(); return(View(pr)); } return(View()); }
public List <SelectListItem> ddCategoryList() { ShopingContext shpContext = new ShopingContext(); List <SelectListItem> selectItemList = new List <SelectListItem>(); foreach (category cgt in shpContext.category) { SelectListItem selectListItem = new SelectListItem { Text = cgt.c_name, Value = cgt.Id.ToString(), }; selectItemList.Add(selectListItem); } return(selectItemList); }
public ActionResult Index_Post(HttpPostedFileBase Image_URl, string Decription) { Slider slider = new Slider(); uploadFile(Image_URl); slider.Image_URl = getfileName; slider.Decription = Decription; slider.IsActive = 1; if (!string.IsNullOrEmpty(getfileName)) { ShopingContext shpContext = new ShopingContext(); shpContext.HomeSlider.Add(slider); shpContext.SaveChanges(); } return(View(slider)); }
public ActionResult Delete(string id) { Brand brand = new Brand(); ShopingContext shpContext = new ShopingContext(); brand.Id = Convert.ToInt32(id); shpContext.Entry(brand).State = System.Data.EntityState.Deleted; int i = shpContext.SaveChanges(); if (i == 1) { return(RedirectToAction("List")); } else { return(RedirectToAction("List")); } }
public ActionResult Login_Post(string USERNAME, string password) { try { ShopingContext shopingContext = new ShopingContext(); Ecommerce.Areas.admin.Models.User.User loginsuccess = shopingContext.User.Single(x => x.email == USERNAME && x.password == password && x.UserType == "admin"); loginsuccess = loginsuccess == null ? null : loginsuccess; if (loginsuccess != null) { Session["userId"] = loginsuccess; return(RedirectToAction("Index", "Home")); } } catch { } return(View()); }
public void getProduct() { ShopingContext shop = new ShopingContext(); List <SelectListItem> selectItemList = new List <SelectListItem>(); foreach (Areas.admin.Models.Product.Product pro in shop.product) { SelectListItem selectItem = new SelectListItem { Text = "Name : " + pro.p_name + " - Model : " + pro.p_model, Value = pro.Id.ToString() }; selectItemList.Add(selectItem); } ViewBag.Products = selectItemList; }
public ActionResult Index_Post(string id, string CategoryList, bool addChildCategory) { category cgt = new category(); TryUpdateModel(cgt); if (ModelState.IsValid) { ShopingContext shpContext = new ShopingContext(); if (string.IsNullOrEmpty(id)) { cgt.c_IsActive = 1; if (addChildCategory) { cgt.c_prent_id = int.Parse(CategoryList); shpContext.category.Add(cgt); } else { shpContext.category.Add(cgt); } } else { if (addChildCategory) { cgt.c_prent_id = int.Parse(CategoryList); shpContext.Entry(cgt).State = System.Data.EntityState.Modified; } else { shpContext.Entry(cgt).State = System.Data.EntityState.Modified; } } int i = shpContext.SaveChanges(); if (i == 1) { return(RedirectToAction("List")); } } _CategoryList(); return(View()); }
public ActionResult Index_Get() { ShopingContext shopingContext = new ShopingContext(); int c_id = 0; try { c_id = ((Ecommerce.Models.Register.RegisterPro)Session["userId"]).Id; getCountry(); } catch { Response.Redirect("~/Home/"); } RegisterPro regpro = shopingContext.registerPro.Where(x => x.Id == c_id).FirstOrDefault(); GetState(regpro.countryId); return(View(regpro)); }
public ActionResult Index() { ShopingContext shpContext = new ShopingContext(); List <OrderDetails> odlist = shpContext.OrderDetails.ToList(); List <FullOrderDetails> FullOrderDetailsList = new List <FullOrderDetails>(); foreach (OrderDetails OD in odlist) { FullOrderDetails FOD = new FullOrderDetails(); FOD.c_id = OD.c_id; FOD.Id = OD.Id; FOD.datetime = OD.datetime; FOD.status = OD.status; FOD.totalPrice = OD.totalPrice; FOD.totalQty = OD.totalQty; FOD.username = shpContext.User.Where(x => x.Id == OD.c_id).FirstOrDefault().fullname; FullOrderDetailsList.Add(FOD); } return(View(FullOrderDetailsList)); }
public ActionResult Index_Get(string id) { _CategoryList(); if (!string.IsNullOrEmpty(id)) { category cgt = new category(); ShopingContext shpContext = new ShopingContext(); int Id = Convert.ToInt32(id); cgt = shpContext.category.Where(x => x.Id == Id).FirstOrDefault(); ViewBag.addChildCategory = cgt.c_prent_id > 0 ? true : false; foreach (SelectListItem selectListItem in ViewBag.CategoryList) { if (selectListItem.Value == Convert.ToString(cgt.c_prent_id)) { selectListItem.Selected = true; } } return(View(cgt)); } return(View()); }
public ActionResult Index_Post() { LoginBean loginBean = new LoginBean(); TryUpdateModel(loginBean); if (ModelState.IsValid) { ShopingContext shopingContext = new ShopingContext(); RegisterPro loginsuccess = shopingContext.registerPro.Single(x => x.email == loginBean.email && x.password == loginBean.password && x.UserType == "user"); loginsuccess = loginsuccess == null ? null : loginsuccess; Session["userId"] = loginsuccess; } if (Session["userId"] == null) { return(View()); } else { return(RedirectToAction("Index", "Home")); } }
public ActionResult Index_Post(string StateID) { if (StateID == null) { getCountry(); return(View()); } ShopingContext shopingContext = new ShopingContext(); RegisterPro reg = new RegisterPro(); reg.statesId = int.Parse(StateID); reg.UserType = "user"; TryUpdateModel(reg); if (ModelState.IsValid) { //Add or Inser Data In DataBase shopingContext.registerPro.Add(reg); shopingContext.SaveChanges(); } getCountry(); return(View()); }
public ActionResult Index_Post(string statesId) { if (statesId == null) { getCountry(); return(View()); } ShopingContext shopingContext = new ShopingContext(); RegisterPro reg = new RegisterPro(); reg.statesId = int.Parse(statesId); reg.UserType = "user"; TryUpdateModel(reg); if (ModelState.IsValid) { //Add or Inser Data In DataBase shopingContext.Entry(reg).State = System.Data.EntityState.Modified; shopingContext.SaveChanges(); } getCountry(); GetState(reg.countryId); return(View()); }
public ActionResult Index_Post(int id, HttpPostedFileBase searchBoxInput) { ViewBag.id = id; UploadImage image = new UploadImage(); TryUpdateModel(image); if (ModelState.IsValid) { uploadFile(searchBoxInput); image.imageURL = getfileName; image.isActive = 1; image.p_id = id; if (!string.IsNullOrEmpty(getfileName)) { ShopingContext shpContext = new ShopingContext(); shpContext.uploadImage.Add(image); shpContext.SaveChanges(); } } getProduct(); ProductImages(id); return(View()); }
public UsersController(ShopingContext context) { _context = context; }