public bool UpdateRecruitment(Recruitment info) { return(RS.UpdateRecruitment(info)); }
public async Task <ActionResult> Edit(RecruitmentViewModel rvm, FormCollection fc) { try { RecruitmentViewModel pvm = new RecruitmentViewModel(); if (!ModelState.IsValid) { //RecruitmentViewModel rcvm = new RecruitmentViewModel(); rvm.VisaStatusList = GetLookUpDropDownList("VisaStatus", null); rvm.EmployementTypeList = GetLookUpDropDownList("EmployementType", null); rvm.CandidateStatusList = GetLookUpDropDownList("CandidateStatus", null); rvm.RecruiterName = User.Identity.Name; rvm.RecruiterId = User.Identity.GetUserId(); return(View(rvm)); } Recruitment recruitment = new Recruitment(); RecruitmentService recruitmentService = new RecruitmentService(); recruitment.Email = rvm.Email; recruitment.RecruiterId = rvm.RecruiterId; recruitment.RecruitmentId = rvm.RecruitmentId; recruitment.PhoneNumber = rvm.PhoneNumber; recruitment.FirstName = rvm.FirstName; recruitment.LastName = rvm.LastName; recruitment.LookupEmployementType = rvm.LookupEmployementType; recruitment.AvailableDate = rvm.AvailableDate; recruitment.Notes = rvm.Notes; recruitment.CurrentLocation = rvm.CurrentLocation; recruitment.C2CCompanyName = rvm.C2CCompanyName; recruitment.C2CContactNumber = rvm.C2CContactNumber; recruitment.C2CContactPerson = rvm.C2CContactPerson; recruitment.C2CEmail = rvm.C2CEmail; recruitment.LookupVisaStatus = rvm.LookupVisaStatus; recruitment.PrimarySkillSet = rvm.PrimarySkillSet; recruitment.SecondarySkillSet = rvm.SecondarySkillSet; recruitment.IsActive = true; recruitment.IsDeleted = false; recruitment.CreatedUserId = rvm.CreatedUserId; recruitment.CreatedDate = rvm.CreatedDate; recruitment.ModifiedDate = DateTime.Now; recruitment.ModifiedUserId = User.Identity.GetUserId(); recruitmentService.UpdateRecruitment(recruitment); //new PasswordHasher.HashPassword TempData["status"] = "Recruitment successfully Updated"; return(RedirectToAction("Index")); } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } throw; } catch (Exception ex) { rvm.EmployementTypeList = GetLookUpDropDownList("EmployementType", null); rvm.RecruiterName = User.Identity.Name; rvm.RecruiterId = User.Identity.GetUserId(); rvm.VisaStatusList = GetLookUpDropDownList("VisaStatus", null); rvm.CandidateStatusList = GetLookUpDropDownList("CandidateStatus", null); TempData["error"] = "Something went wrong while adding Recruiter"; return(View(rvm)); } }