public async Task <IActionResult> Edit(Odam odam) { db.Odamon.Update(odam); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <IActionResult> ConfirmDelete(int?Id) { if (Id != null) { Odam odam = await db.Odamon.FirstOrDefaultAsync(p => p.Id == Id); if (odam != null) { return(View(odam)); } } return(NotFound()); }
public async Task <IActionResult> Delete(int?Id) { if (Id != null) { Odam odam = new Odam { Id = Id.Value }; db.Entry(odam).State = EntityState.Deleted; await db.SaveChangesAsync(); return(RedirectToAction("Index")); #region //Odam odam = await db.Odamon.FirstOrDefaultAsync(p => p.Id == Id); //if (odam != null) //{ // db.Odamon.Remove(odam); // await db.SaveChangesAsync(); // return RedirectToAction("Index"); //} #endregion } return(NotFound()); }