public ActionResult CreateDiscount() { var viewModel = new CertainValueCertainProductDiscountViewModel(); viewModel.EffectiveDate = DateTime.Today; viewModel.EndDate = DateTime.Today.AddDays(1); ViewBag.ProductList = _certainValueCertainProductDiscountViewModelBuilder.ProductList(); return View(viewModel); }
public ActionResult CreateDiscount(CertainValueCertainProductDiscountViewModel viewModel) { try { _certainValueCertainProductDiscountViewModelBuilder.ThrowIfExists(viewModel); _certainValueCertainProductDiscountViewModelBuilder.Save(viewModel); TempData["msg"] = "Discount Successfully Created"; _auditLogViewModelBuilder.AddAuditLog(this.User.Identity.Name, "Create", "Certain Value Certain Product", DateTime.Now); return RedirectToAction("ListCertainValueCertainProduct"); } catch (DomainValidationException dve) { ValidationSummary.DomainValidationErrors(dve, ModelState); ViewBag.ProductList = _certainValueCertainProductDiscountViewModelBuilder.ProductList(); return View(viewModel); } catch (Exception exx) { ViewBag.msg = exx.Message; ViewBag.ProductList = _certainValueCertainProductDiscountViewModelBuilder.ProductList(); return View(viewModel); } }
public ActionResult EditDiscount(Guid id) { var viewModel= new CertainValueCertainProductDiscountViewModel(); viewModel = _certainValueCertainProductDiscountViewModelBuilder.Get(Guid.Parse(id.ToString())); ViewBag.ProductList = _certainValueCertainProductDiscountViewModelBuilder.ProductList(); return View(viewModel); }