public IHttpActionResult PutApplicant(int id, Applicant applicant)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != applicant.applicationNo)
            {
                return(BadRequest());
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ApplicantExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutJob(int id, Job job)
        {
            if (id != job.jobId)
            {
                return(BadRequest());
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!JobExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public bool DeleteUser(int id)
        {
            try
            {
                //establishing database connection
                using (ORSDatabaseEntities db = new ORSDatabaseEntities())
                {
                    //deletes the user with specific id
                    User user    = db.Users.Where(f => f.userId == id).FirstOrDefault();
                    User objUser = new User()
                    {
                        userId   = user.userId,
                        password = user.password,
                        email    = user.email,
                        userName = user.userName,
                        phone    = user.phone,
                        gender   = user.gender,
                        roleId   = user.roleId
                    };
                    if (objUser != null)
                    {
                        //db.Users.Remove(user);
                        ////updates the changes in the database
                        //db.SaveChanges();

                        db.Entry(objUser).State = System.Data.Entity.EntityState.Deleted;
                        db.SaveChanges();

                        return(true);
                    }

                    else
                    {
                        //throws user defined exception
                        throw new UserException("User does not exist");
                    }
                }
            }
            catch (Exception ex)
            {
                //throws user defined exception
                throw new UserException(ex.Message);
            }
        }