public IHttpActionResult DeleteInstructor([FromUri] int instructorID)
        {
            var svc = new InstructorService();

            if (!svc.DeleteInstructor(instructorID))
            {
                return(InternalServerError());
            }
            return(Ok("Instructor successfully deleted."));
        }
示例#2
0
        protected void repeaterInstructor_ItemCommand(object sender, RepeaterCommandEventArgs e)
        {
            var instructorID = Convert.ToInt32(e.CommandArgument);

            if (e.CommandName == "edit")
            {
                Response.Redirect("AddInstructor.aspx?id=" + instructorID);
            }
            if (e.CommandName == "delete")
            {
                InstructorService instructorService = new InstructorService();
                instructorService.DeleteInstructor(Convert.ToInt32(instructorID));
                Response.Redirect("ListInstructor.aspx");
            }
            if (e.CommandName == "details")
            {
                Response.Redirect("DetailsInstructor.aspx?id=" + instructorID);
            }
        }
        public async Task <ActionResult> DeleteInstructor(string id)
        {
            await _instructorService.DeleteInstructor(id);

            return(Ok());
        }