public int Add([FromBody] ApplicantModel value) { var existingApplicant = applicants.FirstOrDefault(a => a.PhoneNumber == value.PhoneNumber); if (existingApplicant == null) { var addedApplicant = applicants.Add(ApplicantConverter.ApplicantModelToApplicant(value)); db.SaveChanges(); return(addedApplicant.Id); } else { return(existingApplicant.Id); } }
public ApplicantModel Get(int id) { return(ApplicantConverter.ApplicantToApplicantModel(applicants.Find(id))); }
public IEnumerable <ApplicantModel> Get() { return(applicants.ToList().Select(a => ApplicantConverter.ApplicantToApplicantModel(a))); }