public ActionResult DeleteConfirmed(int id) { tbld_Outlet tbldOutlet = Db.tbld_Outlet.Find(id); if (tbldOutlet != null) { Db.tbld_Outlet.Remove(tbldOutlet); } Db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult ApproveOutlet(DBhouseoutletVm dBhouseoutletVm) { if (ModelState.IsValid) { tbld_Outlet tbldOutlet = new tbld_Outlet { OutletId = dBhouseoutletVm.OutletId, OutletCode = dBhouseoutletVm.OutletCode, OutletName = dBhouseoutletVm.OutletName, OutletName_b = dBhouseoutletVm.OutletNameB, Location = dBhouseoutletVm.Location, Address = dBhouseoutletVm.Address, GpsLocation = dBhouseoutletVm.GpsLocation, OwnerName = dBhouseoutletVm.OwnerName, ContactNo = dBhouseoutletVm.ContactNo, Distributorid = dBhouseoutletVm.Distributorid, HaveVisicooler = dBhouseoutletVm.HaveVisicooler, parentid = dBhouseoutletVm.Parentid, outlet_category_id = dBhouseoutletVm.OutletCategoryId, grading = dBhouseoutletVm.Grading, channel = dBhouseoutletVm.Channel, Latitude = dBhouseoutletVm.Latitude, Longitude = dBhouseoutletVm.Longitude, picture = dBhouseoutletVm.Picture, IsActive = dBhouseoutletVm.IsActive, createdate = DateTime.Now }; Db.tbld_Outlet.Add(tbldOutlet); Db.tbld_Outlet_new.Where(x => x.Id == tbldOutlet.OutletId).ToList().ForEach(x => { x.verify_status = 1; x.verifydate = DateTime.Now; x.verify_by = (int)Session["User_Id"]; }); Db.SaveChanges(); TempData["alertbox"] = "success"; TempData["alertboxMsg"] = dBhouseoutletVm.OutletName + " Approve Successfully"; return(RedirectToAction("ApproveIndex")); } ViewBag.Distributor = new SelectList(Db.tbld_distribution_house.Where(x => x.Status == 1), "DB_Id", "DBName"); ViewBag.parent = new SelectList(Db.tbld_distributor_Route.Where(x => x.DistributorID == dBhouseoutletVm.Distributorid && x.IsActive == 1), "RouteID", "RouteName"); ViewBag.outlet_category = new SelectList(Db.tbld_Outlet_category, "id", "outlet_category_name"); ViewBag.gradinglist = new SelectList(Db.tbld_Outlet_grade, "id", "name"); ViewBag.channellist = new SelectList(Db.tbld_Outlet_channel, "id", "name"); ViewBag.IsActivelist = new SelectList(Db.status, "status_Id", "status_code"); return(View(dBhouseoutletVm)); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tbld_Outlet tbldOutlet = Db.tbld_Outlet.Find(id); if (tbldOutlet == null) { return(HttpNotFound()); } return(View(tbldOutlet)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tbld_Outlet tbldOutlet = Db.tbld_Outlet.Find(id); if (tbldOutlet == null) { return(HttpNotFound()); } DBhouseoutletVm dBhouseoutletVm = new DBhouseoutletVm { OutletId = tbldOutlet.OutletId, OutletCode = tbldOutlet.OutletCode, OutletName = tbldOutlet.OutletName, OutletNameB = tbldOutlet.OutletName_b, Location = tbldOutlet.Location, Address = tbldOutlet.Address, GpsLocation = tbldOutlet.GpsLocation, OwnerName = tbldOutlet.OwnerName, ContactNo = tbldOutlet.ContactNo, Distributorid = (int)tbldOutlet.Distributorid, HaveVisicooler = (int)tbldOutlet.HaveVisicooler, Parentid = (int)tbldOutlet.parentid, OutletCategoryId = (int)tbldOutlet.outlet_category_id, Grading = (int)tbldOutlet.grading, Channel = (int)tbldOutlet.channel, Latitude = tbldOutlet.Latitude, Longitude = tbldOutlet.Longitude, Picture = tbldOutlet.picture, IsActive = (int)tbldOutlet.IsActive, Createdate = (DateTime)tbldOutlet.createdate }; ViewBag.Distributor = new SelectList(Db.tbld_distribution_house.Where(x => x.Status == 1), "DB_Id", "DBName"); ViewBag.parent = new SelectList(Db.tbld_distributor_Route.Where(x => x.DistributorID == dBhouseoutletVm.Distributorid && x.IsActive == 1 && x.RouteType == 2), "RouteID", "RouteName"); ViewBag.outlet_category = new SelectList(Db.tbld_Outlet_category, "id", "outlet_category_name"); ViewBag.gradinglist = new SelectList(Db.tbld_Outlet_grade, "id", "name"); ViewBag.channellist = new SelectList(Db.tbld_Outlet_channel, "id", "name"); ViewBag.IsActivelist = new SelectList(Db.status, "status_Id", "status_code"); return(View(dBhouseoutletVm)); }
public ActionResult Edit(DBhouseoutletVm dBhouseoutletVm) { if (ModelState.IsValid) { tbld_Outlet tbldOutlet = new tbld_Outlet { OutletId = dBhouseoutletVm.OutletId, OutletCode = dBhouseoutletVm.OutletCode, OutletName = dBhouseoutletVm.OutletName, OutletName_b = dBhouseoutletVm.OutletNameB, Location = dBhouseoutletVm.Location, Address = dBhouseoutletVm.Address, GpsLocation = dBhouseoutletVm.GpsLocation, OwnerName = dBhouseoutletVm.OwnerName, ContactNo = dBhouseoutletVm.ContactNo, Distributorid = dBhouseoutletVm.Distributorid, HaveVisicooler = dBhouseoutletVm.HaveVisicooler, parentid = dBhouseoutletVm.Parentid, outlet_category_id = dBhouseoutletVm.OutletCategoryId, grading = dBhouseoutletVm.Grading, channel = dBhouseoutletVm.Channel, Latitude = dBhouseoutletVm.Latitude, Longitude = dBhouseoutletVm.Longitude, picture = dBhouseoutletVm.Picture, IsActive = dBhouseoutletVm.IsActive, createdate = dBhouseoutletVm.Createdate }; Db.Entry(tbldOutlet).State = EntityState.Modified; Db.SaveChanges(); TempData["alertbox"] = "success"; TempData["alertboxMsg"] = dBhouseoutletVm.OutletName + " Edit Successfully"; return(RedirectToAction("Index")); } ViewBag.Distributor = new SelectList(Db.tbld_distribution_house.Where(x => x.Status == 1), "DB_Id", "DBName"); ViewBag.parent = new SelectList(Db.tbld_distributor_Route.Where(x => x.DistributorID == dBhouseoutletVm.Distributorid && x.IsActive == 1), "RouteID", "RouteName"); ViewBag.outlet_category = new SelectList(Db.tbld_Outlet_category, "id", "outlet_category_name"); ViewBag.gradinglist = new SelectList(Db.tbld_Outlet_grade, "id", "name"); ViewBag.channellist = new SelectList(Db.tbld_Outlet_channel, "id", "name"); ViewBag.IsActivelist = new SelectList(Db.status, "status_Id", "status_code"); return(View(dBhouseoutletVm)); }