//for update only
 public void UpdateInCountry(Countrydata objCountryData)
 {
     try
     {
         objCountryData.Validate();
         CountryDB.UpdateCountry(objCountryData);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public IHttpActionResult Put([FromBody] Country country)
        {
            try
            {
                int val = CountryDB.UpdateCountry(country.CountryId, country.Description);

                if (val > 0)
                {
                    return(Content(HttpStatusCode.OK, country));
                }
                else
                {
                    return(Content(HttpStatusCode.NotFound, $"{country.Description} was not found to update!"));
                }
            }
            catch (Exception ex)
            {
                return(Content(HttpStatusCode.BadRequest, ex));
            }
        }
Ejemplo n.º 3
0
 //for Updating the data in the table
 public void UpdateCountry(Country country)
 {
     countryDB = new CountryDB();
     countryDB.UpdateCountry(country);
 }