// POST api/contacts
 public HttpResponseMessage Post([FromBody] Contact contact)
 {
     try
     {
         var conn    = WebApiConfig.GetMySqlConnection();
         var command = conn.CreateCommand();
         command.CommandText = @"INSERT INTO contacts
                                 (`id`, `isFavorite`, `first`,
                                  `last`, `dob`, `phone`,
                                  `gender`, `rel`, `des`)
                                 VALUES
                                 (NULL, 0, @first,
                                 @last, @dob, @phone,
                                 @gender, @rel, @des)";
         ContactMapper.GetParametersFromContact(command, contact);
         conn.Open();
         try
         {
             if (command.ExecuteNonQuery() != 1)
             {
                 return(Request.CreateResponse(HttpStatusCode.NotFound));
             }
         }
         catch
         {
             throw;
         }
     }
     catch
     {
         return(Request.CreateResponse(HttpStatusCode.InternalServerError));
     }
     return(Request.CreateResponse(HttpStatusCode.OK));
 }
        // PUT api/contacts/5
        public HttpResponseMessage Put(int id, [FromBody] Contact contact)
        {
            try
            {
                var conn    = WebApiConfig.GetMySqlConnection();
                var command = conn.CreateCommand();
                command.CommandText = @"UPDATE contacts
		                                SET first=@first, last=@last,
		                                dob=@dob, phone=@phone, gender=@gender,
		                                rel=@rel, des=@des WHERE id=@id"        ;
                command.Parameters.AddWithValue("@id", id);
                ContactMapper.GetParametersFromContact(command, contact);
                conn.Open();
                try
                {
                    if (command.ExecuteNonQuery() != 1)
                    {
                        return(Request.CreateResponse(HttpStatusCode.NotFound));
                    }
                }
                catch
                {
                    throw;
                }
            }
            catch
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError));
            }
            return(Request.CreateResponse(HttpStatusCode.OK));
        }