//GET DETAIL DOUBLE CHECK THIS public ActionResult Details(int id) { var service = new ShopServicesService(id); var model = service.GetShopServiceById(id); return(View(model)); }
public ActionResult DeletePost(int id, int ShopID) //added in ShopDetail Model { var service = new ShopServicesService(id); service.DeleteShopService(id); //added in ShopDetail Model TempData["SaveResult"] = "Your Shop Service was deleted"; return(RedirectToAction("Details", "Shop", new { ShopID = ShopID })); //takes you to the shop details view }
public ActionResult Details(int ShopID) { var svc = CreateShopService(); var model = svc.GetShopById(ShopID); var svc2 = new ShopServicesService(model.ShopID); var svc3 = new ShopHoursServices(model.ShopID); ViewBag.ShopServices = svc2.GetShopServices(); ViewBag.ShopHours = svc3.GetShopHours(); return(View(model)); }
public ActionResult Edit(int id) { var service = new ShopServicesService(id); var detail = service.GetShopServiceById(id); var model = new ShopServiceEdit { ServiceID = detail.ServiceID, ServiceName = detail.ServiceName, Description = detail.Description, Duration = detail.Duration, Price = detail.Price }; return(View(model)); }
public ActionResult Create(ShopServiceCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = new ShopServicesService(model.ShopID); if (service.CreateShopService(model)) { TempData["SaveResult"] = "Your service was created."; return(RedirectToAction("Details", "Shop", new { ShopID = model.ShopID })); } ; ModelState.AddModelError("", "Service could not be created."); return(View(model)); }
public ActionResult Edit(int id, ShopServiceEdit model) { if (!ModelState.IsValid) { return(View(model)); } if (model.ServiceID != id) { ModelState.AddModelError("", "Id Mismatch"); return(View(model)); } var service = new ShopServicesService(id); if (service.UpdateShopService(model)) { TempData["SaveResult"] = "Your shop service was updated."; return(RedirectToAction("Details", "ShopService", new { id = model.ServiceID }));// redirect to service details } ModelState.AddModelError("", "Your shop service could not be updated."); return(View(model)); }