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 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 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 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 Edit([Bind(Include = "Id,OrderDate,Amount,UserName")] Order order) { if (ModelState.IsValid) { db.Entry(order).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(order)); }
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 Edit([Bind(Include = "Id,CategoryName,CategoryRank")] Category category) { if (ModelState.IsValid) { db.Entry(category).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(category)); }
public ActionResult Edit([Bind(Include = "Id,ProductName,ProductPrice,ProductImageUrl,ProductRank,CategoryId")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryId = new SelectList(db.Categories, "Id", "CategoryName", product.CategoryId); return(View(product)); }
public ActionResult Edit([Bind(Include = "Id,FeatureName,FeatureDetail,ProductId")] Feature feature) { if (ModelState.IsValid) { db.Entry(feature).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ProductId = new SelectList(db.Products, "Id", "ProductName", feature.ProductId); return(View(feature)); }
public ActionResult Edit([Bind(Include = "Id,ProductId,UnitPrice,Quantity,OrderId")] OrderDetail orderDetail) { if (ModelState.IsValid) { db.Entry(orderDetail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.OrderId = new SelectList(db.Orders, "Id", "UserName", orderDetail.OrderId); ViewBag.ProductId = new SelectList(db.Products, "Id", "ProductName", orderDetail.ProductId); return(View(orderDetail)); }
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 Index(Activity a) { if (a.ID > 0) { a.Status = "pending"; a.CreatedAt = a.StartDate; a.UpdatedAt = a.StartDate; db.Entry(a).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } a.Status = "pending"; a.CreatedAt = a.StartDate; a.UpdatedAt = a.StartDate; a.AssignedBy = 1; a.AssignedTo = 1; db.Activities.Add(a); db.SaveChanges(); return(RedirectToAction("Index")); }
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()); }