public ActionResult ProfessionalDetails() { try { if (Session["UserId"] != null) { int UserId = Convert.ToInt32(Session["UserId"].ToString()); ProfessionalDetail Profdetails = ProfessionalDetailsservice.Get(UserId); List <Graduation> _GraduationYears = new List <Graduation>(); DateTime CurrentDate = DateTime.Now; int Year = CurrentDate.Year; for (int i = 1970; i <= Year; i++) { _GraduationYears.Add(new Graduation { GraduationYear = "" + i, GraduationYearId = i }); } if (Profdetails != null) { ProfessionalDetails details = new ProfessionalDetails() { Company = Profdetails.Company, Designation = Profdetails.Designation, WorkedFrom = Profdetails.WorkedFrom, WorkedTill = Profdetails.WorkedTill, GraduationYears = _GraduationYears }; return(View(details)); } else { ProfessionalDetails details = new ProfessionalDetails() { Company = null, Designation = null, WorkedFrom = null, WorkedTill = null, GraduationYears = _GraduationYears }; return(View(details)); } } else { return(RedirectToAction("Login", "Account", new { area = "" })); } } catch (SystemException ex) { } return(View()); }
public ActionResult ProfessionalDetails(ProfessionalDetails Profdetails) { if (Session["UserId"] != null) { int UserId = Convert.ToInt32(Session["UserId"].ToString()); if (ModelState.IsValid) { ProfessionalDetail Profdetail = new ProfessionalDetail() { Company = Profdetails.Company, Designation = Profdetails.Designation, WorkedFrom = Profdetails.WorkedFrom, WorkedTill = Profdetails.WorkedTill }; ProfessionalDetailsservice.UpdateUserProfDetails(UserId, Profdetail); TempData["Success"] = UtilitiesClass.SuccessMessage; return(RedirectToAction("Profile", "Profile", new { area = "Alumini" })); } ProfessionalDetail ProfDet = ProfessionalDetailsservice.Get(UserId); List <Graduation> _GraduationYears = new List <Graduation>(); for (int i = 1970; i <= 2015; i++) { _GraduationYears.Add(new Graduation { GraduationYear = "" + i, GraduationYearId = i }); } ProfessionalDetails details = new ProfessionalDetails() { Company = Profdetails.Company, Designation = ProfDet.Designation, WorkedFrom = ProfDet.WorkedFrom, WorkedTill = ProfDet.WorkedTill, GraduationYears = _GraduationYears }; return(View(details)); } else { return(RedirectToAction("Login", "Account", new { area = "" })); } }