/// <summary> /// Issue an invitation to another employer person. /// Note: Sender side. /// </summary> /// <param name="employerPersonId"></param> /// <param name="recipientEmail"></param> public void InviteEmployerPerson(int employerPersonId, string recipientEmail) { //gets the sender employer person's email from db. string senderEmail = null; using (var db = new JobyJobsDB2()) { employer_persons senderEmployerPerson = db.employer_persons.First(item => item.employer_person_id == employerPersonId); senderEmail = senderEmployerPerson.email; } //perform the actual sending of the mail. _sp.GetService <IEmailSender>().Send(new MailMessage(senderEmail, recipientEmail, $"Invite to JobyJobs", "Hi, You're invited to join our system, your link is http://tinyurl.com/dfkodskfodfko")); //todo //adds an invitation to the db. using (var db = new JobyJobsDB2()) { db.employer_persons_invites.Add(new employer_persons_invites() { invite_uid = Guid.NewGuid().ToString(), employer_person_id = employerPersonId, date = DateTime.Now, recipient_email = recipientEmail, status_id = (int)Enums.EmployerPersonInviteStatuses.Sent }); //Todo. add. transaction scoping. db.SaveChanges(); } }
public static employer_persons DBUpdateFrom(this employer_persons item, EmployerPerson svcItem) //for update { item.first_name = svcItem.FirstName; item.last_name = svcItem.LastName; item.phone_number = svcItem.PhoneNumber; item.id_number = svcItem.IdNumber; item.job_function = svcItem.JobFunction; return(item); }
public static EmployerPerson ToBusiness(this employer_persons item) //for read. { return(AutoMapper.Mapper.Instance.Map <employer_persons, EmployerPerson>(item).CompleteCreate(item)); }
public EmployerPerson CompleteCreate(employer_persons item) { this.Language = (Enums.AppLanguages)item.lang_id.GetValueOrDefault(Consts.MainLanguageId); return(this); }