public ActionResult UpdateProfile(Users user, HttpPostedFileBase UploadResume) { Users users = new Users(); ActionResult result = this.ValidateAuthorToken(); if (result != null) { return(result); } if (UploadResume != null) { string uploadedPath = Server.MapPath("~/UploadedFiles/ReviewerResume"); bool exists = Directory.Exists(uploadedPath); if (!exists) { Directory.CreateDirectory(uploadedPath); } string sFileName = Path.GetFileName(UploadResume.FileName); string sUploadFileName = string.Format("{0}-{1}{2}", Path.GetFileNameWithoutExtension(sFileName), Guid.NewGuid().ToString("N"), Path.GetExtension(sFileName)); string filePath = Path.Combine(uploadedPath, sUploadFileName); user.ResumeFileName = sUploadFileName; UploadResume.SaveAs(Path.Combine(uploadedPath, user.ResumeFileName)); } else { user.ResumeFileName = user.UpdateResumeFileName; } CommonCode commonCode = new CommonCode(); List <Tuple <int, string> > lstSpecialization = _review.GetSpecialization(commonCode); List <SelectListItem> lstSpec = new List <SelectListItem>(); foreach (var specialization in lstSpecialization) { lstSpec.Add(new SelectListItem { Value = specialization.Item1.ToString(), Text = specialization.Item2 }); } ViewBag.Specialization = new SelectList(lstSpec, "Value", "Text"); users = _review.UpdateProfile(user); TempData["ReviewerUpdated"] = "Record updated successfully..."; return(View("MyProfile", users)); }