private void UploadLogo() { if (Logo != null) { if (Skill.LogoFilePath != null) { _fileUploader.DeleteOldFile(uploadPath, Skill.LogoFilePath); Skill.LogoFilePath = _fileUploader.ProcessUploadedFile(Logo, uploadPath); } else if (string.IsNullOrEmpty(Skill.LogoFilePath) || string.IsNullOrWhiteSpace(Skill.LogoFilePath)) { Skill.LogoFilePath = _fileUploader.ProcessUploadedFile(Logo, uploadPath); } } }
public IActionResult OnPost() { if (CertificatePdf != null) { if (Certificate.CertificateFileName != null) { _fileUploader.DeleteOldFile(uploadPath, Certificate.CertificateFileName); Certificate.CertificateFileName = _fileUploader.ProcessUploadedFile(CertificatePdf, uploadPath); } else if (string.IsNullOrEmpty(Certificate.CertificateFileName) || string.IsNullOrWhiteSpace(Certificate.CertificateFileName)) { Certificate.CertificateFileName = _fileUploader.ProcessUploadedFile(CertificatePdf, uploadPath); } } if (!ModelState.IsValid) { PopulateSkillsDropDownList(_skillData); return(Page()); } if (Certificate.Id > 0) { _certificateData.Update(Certificate); } else { _certificateData.Add(Certificate); } _certificateData.Commit(); TempData["Message"] = $"{Certificate.CertificateName} Saved"; return(RedirectToPage("./CertificateList")); }
private void UploadThumb() { if (ProjectThumb != null) { if (FreeCodeCampProject.FccProjectThumb != null) { _fileUploader.DeleteOldFile(uploadPath, FreeCodeCampProject.FccProjectThumb); FreeCodeCampProject.FccProjectThumb = _fileUploader.ProcessUploadedFile(ProjectThumb, uploadPath); } else if (string.IsNullOrEmpty(FreeCodeCampProject.FccProjectThumb) || string.IsNullOrWhiteSpace(FreeCodeCampProject.FccProjectThumb)) { FreeCodeCampProject.FccProjectThumb = _fileUploader.ProcessUploadedFile(ProjectThumb, uploadPath); } } }
private void UploadThumb() { if (ProjectThumb != null) { if (PersonalProject.ProjectThumb != null) { _fileUploader.DeleteOldFile(uploadPath, PersonalProject.ProjectThumb); PersonalProject.ProjectThumb = _fileUploader.ProcessUploadedFile(ProjectThumb, uploadPath); } else if (string.IsNullOrEmpty(PersonalProject.ProjectThumb) || string.IsNullOrWhiteSpace(PersonalProject.ProjectThumb)) { PersonalProject.ProjectThumb = _fileUploader.ProcessUploadedFile(ProjectThumb, uploadPath); } } }