public IHttpActionResult PostAnahiAgreda(AnahiAgreda anahiAgreda) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.AnahiAgredas.Add(anahiAgreda); try { db.SaveChanges(); } catch (DbUpdateException) { if (AnahiAgredaExists(anahiAgreda.CodeThreeLetter)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = anahiAgreda.CodeThreeLetter }, anahiAgreda)); }
public IHttpActionResult PutAnahiAgreda(string id, AnahiAgreda anahiAgreda) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != anahiAgreda.CodeThreeLetter) { return(BadRequest()); } db.Entry(anahiAgreda).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AnahiAgredaExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetAnahiAgreda(string id) { AnahiAgreda anahiAgreda = db.AnahiAgredas.Find(id); if (anahiAgreda == null) { return(NotFound()); } return(Ok(anahiAgreda)); }
public IHttpActionResult DeleteAnahiAgreda(string id) { AnahiAgreda anahiAgreda = db.AnahiAgredas.Find(id); if (anahiAgreda == null) { return(NotFound()); } db.AnahiAgredas.Remove(anahiAgreda); db.SaveChanges(); return(Ok(anahiAgreda)); }