protected void RepeaterPerson_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var PersonId = Convert.ToInt32(e.CommandArgument);

            if (e.CommandName == "Edit")
            {
                Response.Redirect("EditPerson.aspx?id=" + PersonId);
            }
            if (e.CommandName == "Delete")
            {
                PeopleService peopleService = new PeopleService();
                peopleService.DeleteById(PersonId);
                Response.Redirect("PeopleList.aspx");
            }
            if (e.CommandName == "Details")
            {
                Response.Redirect("DetailsPerson.aspx?id=" + PersonId);
            }
        }
示例#2
0
 public ActionResult Delete(int id)
 {
     peopleService.DeleteById(id);
     return(RedirectToAction("Index"));
 }