public IHttpActionResult PutTaxByStates(int id, TaxByStates taxByStates) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != taxByStates.Id) { return(BadRequest()); } db.Entry(taxByStates).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TaxByStatesExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetTaxByStates(int id) { TaxByStates taxByStates = db.TaxByStates.Find(id); if (taxByStates == null) { return(NotFound()); } return(Ok(taxByStates)); }
public IHttpActionResult PostTaxByStates(TaxByStates taxByStates) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.TaxByStates.Add(taxByStates); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = taxByStates.Id }, taxByStates)); }
public IHttpActionResult DeleteTaxByStates(int id) { TaxByStates taxByStates = db.TaxByStates.Find(id); if (taxByStates == null) { return(NotFound()); } db.TaxByStates.Remove(taxByStates); db.SaveChanges(); return(Ok(taxByStates)); }