public async Task <IActionResult> Create(SectionCardCreateViewModel sectionCardViewModel) { sectionCardViewModel.EnDescription.ValidateHtml("EnDescription", ModelState); sectionCardViewModel.EnDescription.ValidateHtml("ArDescription", ModelState); if (sectionCardViewModel.Photo == null || sectionCardViewModel.File == null) { ModelState.AddModelError(nameof(sectionCardViewModel.Photo), "you should uplaod a photo and file."); ModelState.AddModelError(nameof(sectionCardViewModel.File), "you should uplaod a photo and file."); _toastNotification.AddWarningToastMessage("you should uplaod a photo and file."); } if (ModelState.IsValid) { PageSectionCardVersion sectionCardVersion = sectionCardViewModel.MapToSectionCardVersion(); sectionCardVersion.ImageUrl = _fileService.UploadImageUrlNew(sectionCardViewModel.Photo); sectionCardVersion.FileUrl = _fileService.UploadFileUrlNew(sectionCardViewModel.File); var user = await _userManager.GetUserAsync(HttpContext.User); sectionCardVersion.CreatedById = user.Id; sectionCardVersion.CreationDate = DateTime.Now; PageSectionCardVersion newPageSectionCardVersion = _sectionCardVersionRepository.Add(sectionCardVersion, sectionCardViewModel.PageRouteVersionId); if (newPageSectionCardVersion != null) { _eventLogger.LogInfoEvent(HttpContext.User.Identity.Name, Common.ActivityEnum.Add, "Dynamic Page > Card > Add", sectionCardVersion.EnTitle); _toastNotification.AddSuccessToastMessage(ToasrMessages.AddSuccess); return(RedirectToAction("Index", new { id = newPageSectionCardVersion.PageSectionVersionId, pageRouteVersionId = newPageSectionCardVersion.PageSectionVersion.PageRouteVersionId })); } else { _eventLogger.LogInfoEvent(HttpContext.User.Identity.Name, Common.ActivityEnum.Warning, "Dynamic Page > Card > Warning", sectionCardVersion.EnTitle); _toastNotification.AddErrorToastMessage(ToasrMessages.warning); } } return(View(sectionCardViewModel)); }