public async Task <IHttpActionResult> Puttransaccions(int id, transaccions transaccions) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != transaccions.id) { return(BadRequest()); } db.Entry(transaccions).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!transaccionsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> Gettransaccions(int id) { transaccions transaccions = await db.transaccions.FindAsync(id); if (transaccions == null) { return(NotFound()); } return(Ok(transaccions)); }
public async Task <IHttpActionResult> Posttransaccions(transaccions transaccions) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.transaccions.Add(transaccions); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = transaccions.id }, transaccions)); }
public async Task <IHttpActionResult> Deletetransaccions(int id) { transaccions transaccions = await db.transaccions.FindAsync(id); if (transaccions == null) { return(NotFound()); } db.transaccions.Remove(transaccions); await db.SaveChangesAsync(); return(Ok(transaccions)); }