Adding Delete ActionResult

What we have to do first? Yes, creating a basic structure for ActionResult as usual.

public ActionResult Delete(int id)
{
    ..
    return View(model);
}

[HttpPost]
public ActionResult Delete(SongModel model)
{
    try
    {
        ..
        context.Songs.DeleteOnSubmit(song);
        context.SubmitChanges();
        return RedirectToAction("Index");
    }
    catch
    {
        return View(model);
    }
}

results matching ""

    No results matching ""