public ActionResult AddProductHeadline() { var viewModel = new ProductHeadlineViewModel(); return View(viewModel); }
public ActionResult EditProductHeadline(int productHeadlineId) { var productHeadline = _productHeadlineRepository.Get(productHeadlineId); var viewModel = new ProductHeadlineViewModel { Id = productHeadline.Id, Name = productHeadline.Name }; return View(viewModel); }
public ActionResult EditProductHeadline(ProductHeadlineViewModel viewModel) { if (!ModelState.IsValid) { foreach (var error in ModelState.Values.SelectMany(m => m.Errors).Select(e => e.ErrorMessage)) { _orchardServices.Notifier.Error(T(error)); } return RedirectToAction("EditProductHeadline", new {productHeadlineId = viewModel.Id}); } var productHeadline = _productHeadlineRepository.Get(viewModel.Id); productHeadline.Name = viewModel.Name; _productHeadlineRepository.Update(productHeadline); _orchardServices.Notifier.Information(T("Product Headline has been edited.")); return RedirectToAction("Index"); }