예제 #1
0
        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));
        }
예제 #2
0
        public IActionResult Create()
        {
            var model = new CreateNewsItemVM();

            return(View(model));
        }