public static UploadFileEducationDto ToDto(this UploadFileEducationViewModel source) { return(new UploadFileEducationDto { EducationId = source.EducationId, File = source.File, Title = source.Title, Type = source.Type }); }
public IActionResult UploadFile(UploadFileEducationViewModel model) { var serviceResult = _adminService.UploadFileForEducation(model.ToDto()); List <SelectListItem> typeSelector = new List <SelectListItem>(); typeSelector.Add(new SelectListItem("توع فایل را انتخاب کنید", "")); typeSelector.Add(new SelectListItem("عکس", EducationFileType.Image.ToString())); typeSelector.Add(new SelectListItem("صوت", EducationFileType.Audio.ToString())); typeSelector.Add(new SelectListItem("ویدیو", EducationFileType.Video.ToString())); typeSelector.Add(new SelectListItem("فایل فشرده", EducationFileType.Zip.ToString())); ViewBag.TypeSelector = typeSelector; ViewBag.EducationId = model.EducationId; ViewBag.Education = _adminService.GetEducations(model.EducationId)?.ToViewModel(); return(View_Post(serviceResult, model)); }