public async Task <IHttpActionResult> PutCajaDepto(int id, CajaDepto cajaDepto) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != cajaDepto.IDCajaDepto) { return(BadRequest()); } db.Entry(cajaDepto).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CajaDeptoExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <ActionResult> DeleteConfirmed(int id) { CajaDepto cajaDepto = await db.CajaDeptoes.FindAsync(id); db.CajaDeptoes.Remove(cajaDepto); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <IHttpActionResult> GetCajaDepto(int id) { CajaDepto cajaDepto = await db.CajaDeptoes.FindAsync(id); if (cajaDepto == null) { return(NotFound()); } return(Ok(cajaDepto)); }
public async Task <ActionResult> Edit([Bind(Include = "IDCajaDepto,NombreCajaDepto")] CajaDepto cajaDepto) { if (ModelState.IsValid) { db.Entry(cajaDepto).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(cajaDepto)); }
public async Task <IHttpActionResult> PostCajaDepto(CajaDepto cajaDepto) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.CajaDeptoes.Add(cajaDepto); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = cajaDepto.IDCajaDepto }, cajaDepto)); }
public async Task <ActionResult> Create([Bind(Include = "IDCajaDepto,NombreCajaDepto")] CajaDepto cajaDepto) { if (ModelState.IsValid) { db.CajaDeptoes.Add(cajaDepto); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(cajaDepto)); }
public async Task <IHttpActionResult> DeleteCajaDepto(int id) { CajaDepto cajaDepto = await db.CajaDeptoes.FindAsync(id); if (cajaDepto == null) { return(NotFound()); } db.CajaDeptoes.Remove(cajaDepto); await db.SaveChangesAsync(); return(Ok(cajaDepto)); }
// GET: CajaDeptoes/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CajaDepto cajaDepto = await db.CajaDeptoes.FindAsync(id); if (cajaDepto == null) { return(HttpNotFound()); } return(View(cajaDepto)); }