public ActionResult Delete(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } Store store = db.Stores.Find(id); if (store == null) { return HttpNotFound(); } StoreDAL storeBO = new StoreDAL(); storeBO.DeleteP(store.StoreID); StoreViewModel str = new StoreViewModel(); StoreDAL sd = new StoreDAL(); str.AllStores = sd.ListStores(); ViewBag.AddressID = new SelectList(db.Addresses, "AddressID", "Address1"); ViewBag.RetailerID = new SelectList(db.Retailers, "RetailerID", "Name"); return View("Index", str); }
public ActionResult Edit([Bind(Include = "StoreID,Name,StoreNumber,RetailerID,EmailID,Phone")] Store store) { StoreViewModel st = new StoreViewModel(); StoreDAL storeBO = new StoreDAL(); Store user = db.Stores.Find(store.StoreID); Address add = db.Addresses.Find(user.AddressID); if (ModelState.IsValid) { st.AllStores = storeBO.ListStores(); st.Store = store; // db.Entry(store).State = EntityState.Modified; // db.SaveChanges(); // ViewBag.AddressID = new SelectList(db.Addresses, "AddressID", "Address1", store.AddressID); ViewBag.RetailerID = new SelectList(db.Retailers, "RetailerID", "Name", store.RetailerID); ViewBag.CityId = new SelectList(db.Cities, "CityID", "Name", add.CityID); ViewBag.ProvinceId = new SelectList(db.Provinces, "ProvinceId", "Name", add.ProvinceID); ViewBag.CountryId = new SelectList(db.Countries, "CountryId", "Name", add.CountryID); ViewBag.ac = "Edit"; st.Address1 = add.Address1; st.Address2 = add.Address2; st.AddressID = add.AddressID; st.PostalCode = add.PostalCode; var usertype = ud.GetUserTypes(); var countries = ud.GetCountry(); var city = ud.GetCity(); var province = ud.GetProvince(); st.CountryDetails = countries; st.ProvinceDetails = province; st.CityDetails = city; return View("Index",st); } // ViewBag.AddressID = new SelectList(db.Addresses, "AddressID", "Address1", store.AddressID); ViewBag.RetailerID = new SelectList(db.Retailers, "RetailerID", "Name", store.RetailerID); return View("Index",st); }
public ActionResult Partialndex() { StoreViewModel store = new StoreViewModel(); StoreDAL sd = new StoreDAL(); store.AllStores = sd.ListStores(); return View("_Store",store.AllStores.ToList()); }
public ActionResult Index() { StoreViewModel store = new StoreViewModel(); StoreDAL sd = new StoreDAL(); store.AllStores = sd.ListStores(); var usertype = ud.GetUserTypes(); var countries = ud.GetCountry(); var city = ud.GetCity(); var province = ud.GetProvince(); store.CountryDetails = countries; store.ProvinceDetails = province; store.CityDetails = city; ViewData["country"] = ud.GetCountry(); ViewBag.AddressID = new SelectList(db.Addresses, "AddressID", "Address1"); ViewBag.RetailerID = new SelectList(db.Retailers, "RetailerID", "Name"); ViewBag.CountryID = new SelectList(db.Countries, "CountryID", "Name"); ViewBag.ProvinceID = new SelectList(db.Provinces, "ProvinceID", "Name"); ViewBag.CityID = new SelectList(db.Cities, "CityID", "Name"); return View(store); }