protected void btnDelete_Click(object sender, EventArgs e)
    {
        List <t_LanguageTranslate> list = languageBL.FindAll(x => x.Language == language && x.Noted.Contains("/Supervisor/Admin/CreateUser.aspx")).ToList();
        var lb_staff_delete_confirm     = list.Where(x => x.ControlId.Contains("lb_staff_delete_confirm")).FirstOrDefault();

        string staffID = cboStaffs.Text;
        var    staff   = _staffBL.GetStaff(staffID);

        if (staff != null)
        {
            _staffBL.DeleteStaff(staff);
            //msg.Text = "Đã xóa nhân viên.";
            msg.Text = lb_staff_delete_confirm.Contents;
            ReBind();
            SetEmpty();
        }
    }
Exemple #2
0
        // PUT: api/Unit/5
        //public ServerResponse Put([FromBody]Staff Staff)
        //{
        //    var res = new ServerResponse();
        //    using (StaffBL StaffBL = new StaffBL())
        //    {
        //        try
        //        {
        //            res.Data = StaffBL.UpdateStaff(Staff);
        //        }

        //        catch (Exception ex)
        //        {
        //            res.Success = false;
        //        }
        //    }
        //    return res;
        //}

        // DELETE: api/Unit/5
        public ServerResponse Delete(string id)
        {
            var res = new ServerResponse();

            using (StaffBL StaffBL = new StaffBL())
            {
                try
                {
                    res.Data = StaffBL.DeleteStaff(id);
                }

                catch (Exception ex)
                {
                    res.Success = false;
                }
            }
            return(res);
        }