public IActionResult Create(SlideViewModel model) { if (model == null) { return(NotFound()); } var homeslider = _mapper.Map <SlideViewModel, HomeSlider>(model); if (ModelState.IsValid) { homeslider.AddedBy = _admin.Name; homeslider.AddedDate = DateTime.Now; if (model.File != null) { homeslider.Image = _fileManager.Upload(model.File); } else { homeslider.Image = null; } _homeRepository.CreateHomeSlider(homeslider); return(RedirectToAction("index")); } return(View()); }