public ActionResult EditIssue(ShopIssueViewModel shopissueVM) { var categoryList = new TagService().GenCategory(); ViewBag.CategoryList = categoryList; if (TempData["ImgPath"] != null) { shopissueVM.ImgPath = (string)TempData["ImgPath"]; } if (ModelState.IsValid) { var service = new ShopIssueService(); var result = service.Update(shopissueVM); if (result.Success) { return(RedirectToAction("IssueList")); } else { ViewBag.Message = "更新失敗!"; System.Console.WriteLine(result.Message); return(View(shopissueVM)); } } return(View()); }
public ActionResult IssueList(int?orderValue) { var service = new ShopIssueService(); var viewModel = service.GetAll(orderValue).Items; return(View(viewModel)); }
public ActionResult EditIssue(string id) { var categoryList = new TagService().GenCategory(); ViewBag.CategoryList = categoryList; if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var service = new ShopIssueService(); ShopIssueViewModel shopissueVM = service.GetIssue(Guid.Parse(id)); if (shopissueVM == null) { return(HttpNotFound()); } TempData["ImgPath"] = shopissueVM.ImgPath; return(View(shopissueVM)); }
public ActionResult CreateIssue(ShopIssueViewModel shopissueVM) { var categoryList = new TagService().GenCategory(); ViewBag.CategoryList = categoryList; if (ModelState.IsValid) { var service = new ShopIssueService(); var result = service.Create(shopissueVM); if (result.Success) { return(RedirectToAction("IssueList")); } else { ViewBag.Message = "新增失敗!"; System.Console.WriteLine(result.Message); return(View(shopissueVM)); } } return(View()); }