public IHttpActionResult Delete(int id)
        {
            UsersBLL userBLL = new UsersBLL();

            userBLL.DeleteUser(id);
            return(Ok());
        }
示例#2
0
 protected void myGrid_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     if (e.CommandName == "del")
     {
         bll.DeleteUser(Convert.ToInt32(e.CommandArgument));
     }
     PageInit();
 }
示例#3
0
        public void DeleteUser()
        {
            UsersBLL userBLL = new UsersBLL();

            userBLL.DeleteUser(1012);
            var user = userBLL.Get(1012);

            Assert.IsNull(user);
        }
示例#4
0
 public void DeleteUser(string actionValue)
 {
     try
     {
         UsersBLL.DeleteUser(actionValue);
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#5
0
    protected void btnDeleteUser_Click(object sender, EventArgs e)
    {
        CheckBox chkUser;
        string   username;
        Literal  litName;

        foreach (GridViewRow row in grdUsers.Rows)
        {
            chkUser = (CheckBox)row.Cells[0].FindControl("chkUser");
            if (chkUser.Checked)
            {
                litName  = (Literal)row.Cells[0].FindControl("LitUserName");
                username = litName.Text;
                userBLL.DeleteUser(username);
            }
        }
        Response.Redirect("/SystemSettings/Users.aspx");
        BindGrid();
    }
示例#6
0
        public IHttpActionResult DeleteUser(int id)
        {
            if (id == 0)
            {
                return(BadRequest("Invalid User ID"));
            }

            try
            {
                bool isDeleted = _usersBLL.DeleteUser(id);
                if (isDeleted == true)
                {
                    return(Ok("User Deleted Successfully!"));
                }
                else
                {
                    return(NotFound());
                }
            }
            catch (Exception exception)
            {
                return(BadRequest(exception.Message));
            }
        }