public async Task <ActionResult> DeleteConfirmed(int id) { Hantel hantel = await _db.Cargos.FindAsync(id); _db.Cargos.Remove(hantel); await _db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Weight,Length,LandingDiameter,OverallDiameter,Model,Name,Description,Code")] Hantel hantel) { if (ModelState.IsValid) { _db.Entry(hantel).State = EntityState.Modified; await _db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(hantel)); }
public async Task <ActionResult> Create([Bind(Include = "Id,Weight,Length,LandingDiameter,OverallDiameter,Model,Name,Description,Code")] Hantel hantel) { if (ModelState.IsValid) { _db.Cargos.Add(hantel); await _db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(hantel)); }
// GET: Hantels/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Hantel hantel = await _db.Cargos.FindAsync(id); if (hantel == null) { return(HttpNotFound()); } return(View(hantel)); }