public async Task <IHttpActionResult> PutService(int id, Service service)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != service.Id)
            {
                return(BadRequest());
            }

            db.Entry(service).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ServiceExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <IHttpActionResult> PostApplicant(HRApplicant applicant)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            applicant.Timestamp = DateTime.Now;


            db.HRApplicants.Add(applicant);
            await db.SaveChangesAsync();

            //generate reg number and password if is a new registration
            if (applicant.ApplicantId.Equals(""))
            {
                var facilityInitial = db.KeyValuePairs.FirstOrDefault(e => e.Key_ == "FacilityInittials").Value;
                var year            = DateTime.Now.ToString("yy");
                var prefix          = "00";
                if (applicant.Id > 9)
                {
                    prefix = "0";
                }
                else if (applicant.Id > 99)
                {
                    prefix = "";
                }
                var branchId    = db.KeyValuePairs.FirstOrDefault(e => e.Key_ == "BranchId").Value;
                var applicantid = facilityInitial + "/" + branchId + "/" + prefix + applicant.Id + "/" + year;
                applicant.ApplicantId = applicantid;
                applicant.Password    = applicantid; //consider generating random password
            }
            else
            {
                applicant.Password = applicant.ApplicantId;
            }


            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = applicant.Id }, applicant));
        }