public async Task <IHttpActionResult> PutNomRules(int id, NomRules nomRules) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != nomRules.Id) { return(BadRequest()); } db.Entry(nomRules).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NomRulesExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetNomRules(int id) { NomRules nomRules = await db.NomRules.FindAsync(id); if (nomRules == null) { return(NotFound()); } return(Ok(nomRules)); }
public async Task <IHttpActionResult> PostNomRules(NomRules nomRules) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.NomRules.Add(nomRules); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = nomRules.Id }, nomRules)); }
public async Task <IHttpActionResult> DeleteNomRules(int id) { NomRules nomRules = await db.NomRules.FindAsync(id); if (nomRules == null) { return(NotFound()); } db.NomRules.Remove(nomRules); await db.SaveChangesAsync(); return(Ok(nomRules)); }