public async Task <ActionResult> DeleteConfirmed(int id) { DispatchCode dispatchCode = await db.DispatchCodes.FindAsync(id); db.DispatchCodes.Remove(dispatchCode); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DispatchCode dispatchCode = await db.DispatchCodes.FindAsync(id); if (dispatchCode == null) { return(HttpNotFound()); } return(View(dispatchCode)); }
public async Task <ActionResult> Edit( [Bind(Include = "Id,Code,CodeDescription,CreatedOn,CreatedBy")] DispatchCode dispatchCode) { if (ModelState.IsValid) { dispatchCode.ModifiedBy = HttpContext.User.Identity.Name; dispatchCode.ModifiedOn = DateTime.Now; db.Entry(dispatchCode).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(dispatchCode)); }