public async Task <IHttpActionResult> PutEntrySlipType(int id, EntrySlipType entrySlipType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != entrySlipType.Id) { return(BadRequest()); } db.Entry(entrySlipType).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EntrySlipTypeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { EntrySlipType entrySlipType = db.EntrySlipTypes.Find(id); db.EntrySlipTypes.Remove(entrySlipType); db.SaveChanges(); return(Json(new { success = true })); }
public ActionResult Edit([Bind(Include = "Id,Name")] EntrySlipType entrySlipType) { if (ModelState.IsValid) { db.Entry(entrySlipType).State = EntityState.Modified; db.SaveChanges(); return(Json(new { success = true })); } return(PartialView(viewName: "Edit", model: entrySlipType)); }
public async Task <IHttpActionResult> GetEntrySlipType(int id) { EntrySlipType entrySlipType = await db.EntrySlipTypes.FindAsync(id); if (entrySlipType == null) { return(NotFound()); } return(Ok(entrySlipType)); }
public ActionResult Create([Bind(Include = "Id,Name")] EntrySlipType entrySlipType) { if (ModelState.IsValid) { db.EntrySlipTypes.Add(entrySlipType); db.SaveChanges(); return(Json(new { success = true })); } return(PartialView(viewName: "Create", model: entrySlipType)); }
public async Task <IHttpActionResult> PostEntrySlipType(EntrySlipType entrySlipType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.EntrySlipTypes.Add(entrySlipType); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = entrySlipType.Id }, entrySlipType)); }
public async Task <IHttpActionResult> DeleteEntrySlipType(int id) { EntrySlipType entrySlipType = await db.EntrySlipTypes.FindAsync(id); if (entrySlipType == null) { return(NotFound()); } db.EntrySlipTypes.Remove(entrySlipType); await db.SaveChangesAsync(); return(Ok(entrySlipType)); }
// GET: EntrySlipTypes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EntrySlipType entrySlipType = db.EntrySlipTypes.Find(id); if (entrySlipType == null) { return(HttpNotFound()); } return(PartialView(viewName: "Delete", model: entrySlipType)); }
// GET: EntrySlipTypes/Create public ActionResult Create() { EntrySlipType est = new EntrySlipType(); return(PartialView(viewName: "Create", model: est)); }