public IActionResult Create(CreateNewsItemVM model) { if (ModelState.IsValid) { var entity = _mapper.Map <NewsItem>(model); entity.Image = new Image(); _imageService.Upload(entity, model.File, EImageType.NewsItem); _newsItemRepository.Add(entity); _unitOfWork.Commit(); return(RedirectToAction("Index")); } return(View(model)); }
public IActionResult Create() { var model = new CreateNewsItemVM(); return(View(model)); }