public string UpdateHtmlFragment(HtmlFragmentViewModel viewModel) { HtmlFragment entity = _htmlFragmentMappingService.MapToEntity(viewModel); string errorMessage = _htmlFragmentRepository.UpdateHtmlFragment(entity, viewModel.BlogId, viewModel.SelectedLocationId); return errorMessage; }
public ActionResult Edit(HtmlFragmentViewModel viewModel) { string errorMessage = _htmlFragmentService.UpdateHtmlFragment(viewModel); if (string.IsNullOrEmpty(errorMessage)) return RedirectToActionPermanent("Index", new {Id = viewModel.BlogId}); viewModel.ErrorMessage = errorMessage; return View(viewModel); }
public HtmlFragmentViewModel GetViewModel(int blogId) { IQueryable<HtmlFragmentLocation> pageLocations = _htmlFragmentRepository .GetAllHtmlPageLocations(); IEnumerable<DropDownViewModel> list = GetLocationSelectList(pageLocations); var viewModel = new HtmlFragmentViewModel { BlogId = blogId, LocationList = new SelectList(list, "Id", "Name") }; return viewModel; }
public HtmlFragment MapToEntity(HtmlFragmentViewModel viewModel) { return Mapper.Map<HtmlFragmentViewModel,HtmlFragment >(viewModel); }