public bool CreateUserProfileToApplicant(UserProfileToApplicantDAO s) { UserProfileToApplicant userProfileToApplicant = new UserProfileToApplicant { UserProfileToApplicant_ID = s.UserProfileToApplicant_ID, Applicant_ID = s.Applicant_ID, UserId = s.UserId }; using (AESDatabaseDataContext db = new AESDatabaseDataContext()) { db.UserProfileToApplicants.InsertOnSubmit(userProfileToApplicant); try { db.SubmitChanges(); } catch (Exception e) { throw new FaultException<KaskServiceException>(new KaskServiceException(), new FaultReason(e.Message)); } } return true; }
public IList<UserProfileToApplicantDAO> GetUserProfileToApplicants() { try { using (AESDatabaseDataContext db = new AESDatabaseDataContext()) { IList<UserProfileToApplicant> userProfileToApplicants = db.UserProfileToApplicants.ToList(); List<UserProfileToApplicantDAO> result = new List<UserProfileToApplicantDAO>(); foreach (var userProfileToApplicant in userProfileToApplicants) { UserProfileToApplicantDAO temp = new UserProfileToApplicantDAO { ID = userProfileToApplicant.UserProfileToApplicant_ID, UserProfileToApplicant_ID = userProfileToApplicant.UserProfileToApplicant_ID, Applicant_ID = userProfileToApplicant.Applicant_ID, UserId = userProfileToApplicant.UserId }; result.Add(temp); } return (result != null ? result : null); } } catch (Exception e) { throw new FaultException<KaskServiceException>(new KaskServiceException(), new FaultReason(e.Message)); } }
public bool UpdateUserProfileToApplicant(UserProfileToApplicantDAO newUserProfileToApplicant) { using (AESDatabaseDataContext db = new AESDatabaseDataContext()) { UserProfileToApplicant userProfileToApplicant = db.UserProfileToApplicants.Single(s => s.UserProfileToApplicant_ID == newUserProfileToApplicant.UserProfileToApplicant_ID); userProfileToApplicant.Applicant_ID = newUserProfileToApplicant.Applicant_ID; userProfileToApplicant.UserId = newUserProfileToApplicant.UserId; try { db.SubmitChanges(); } catch (Exception e) { throw new FaultException<KaskServiceException>(new KaskServiceException(), new FaultReason(e.Message)); } } return true; }
public UserProfileToApplicantDAO GetUserProfileToApplicantByID(int id) { try { using (AESDatabaseDataContext db = new AESDatabaseDataContext()) { UserProfileToApplicant userProfileToApplicant = (from upta in db.UserProfileToApplicants where upta.UserProfileToApplicant_ID == id select upta).FirstOrDefault(); UserProfileToApplicantDAO result = new UserProfileToApplicantDAO { ID = userProfileToApplicant.UserProfileToApplicant_ID, UserProfileToApplicant_ID = userProfileToApplicant.UserProfileToApplicant_ID, Applicant_ID = userProfileToApplicant.Applicant_ID, UserId = userProfileToApplicant.UserId }; return (result != null ? result : null); } } catch (Exception e) { throw new FaultException<KaskServiceException>(new KaskServiceException(), new FaultReason(e.Message)); } }