internal string SaveUserProfileData(UserProfileData userProfile, string email) { using (OnboardEntities db = new OnboardEntities()) { try { if (db.UserOfferDetails.Where(x => x.emailID == email).SingleOrDefault().isSubmitted == false) { UserProfile profiledata = db.UserProfiles.Include("AdditionalDatas") .Include("FunctionalSkillDatas") .Include("CertificationDatas") .Include("EmployerDatas") .Include("InsuranceDatas") .Include("MembershipDatas") .Include("PersonalDatas") .Include("QualificationDatas") .Include("TainingDatas") .Include("FileDatas") .Include("TechnicalSkillDatas").Where(s => s.email == email).FirstOrDefault(); if (profiledata != null) { profiledata = UpdateProfileData(userProfile, profiledata); db.SaveChanges(); } else { UserProfile profile = GenerateProfileData(userProfile, email); db.UserProfiles.Add(profile); db.SaveChanges(); } return("Data is saved Successfully"); } else { return("Data is already submitted cannot make any further changes"); } } catch (Exception ex) { throw ex; } } }
public void SetLoginAccess(int index) { using (OnboardEntities db = new OnboardEntities()) { UserOfferDetail selectedUser = db.UserOfferDetails.SingleOrDefault(x => x.id == index); if (selectedUser.isEditable == true) { selectedUser.isEditable = false; } else if (selectedUser.isEditable == false) { selectedUser.isEditable = true; selectedUser.isSubmitted = false; } db.SaveChanges(); } }
internal string SubmitUserData(string email) { try { using (OnboardEntities db = new OnboardEntities()) { var data = db.UserOfferDetails.Where(x => x.emailID == email).Single(); if (!data.isSubmitted == true) { db.SaveChanges(); return("Data is submitted successfully"); } else { return("Already Submitted"); } } } catch (Exception ex) { throw ex; } }