public bool Insert(string userName, string password, string fullName, string sex, string birthDay, string address, string phone, string email, string nameOff)
        {
            try
            {
                OfficeService officeService = new OfficeService(_context);
                Office        off           = officeService.GetOffice(nameOff);
                if (off == null)
                {
                    return(false);
                }
                var userEx = _context.Employes.Where(x => x.userName == userName).SingleOrDefault();

                if (userEx != null)
                {
                    return(false);
                }

                Employe user = new Employe
                {
                    userName     = userName,
                    password     = GenerateHash.Instance.ComputeSha256Hash(password),
                    fullName     = fullName,
                    sex          = sex == "nam" ? true : false,
                    birthDay     = Convert.ToDateTime(birthDay),
                    address      = address,
                    phoneNumber  = phone,
                    email        = email,
                    dayAtWork    = DateTime.Now,
                    statusOfWork = true,
                    createDate   = DateTime.Now,
                    updateDate   = DateTime.Now,
                    Offices      = off
                };

                _context.Employes.Add(user);
                _context.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
            }
            return(false);
        }
        public bool Update(object tables)
        {
            try
            {
                DataTable dataTable = new DataTable();
                dataTable.Clear();
                dataTable.Columns.Add("Id", typeof(string));
                dataTable.Columns.Add("userName", typeof(string));
                dataTable.Columns.Add("password", typeof(string));
                dataTable.Columns.Add("fullName", typeof(string));
                dataTable.Columns.Add("sex", typeof(bool));
                dataTable.Columns.Add("birthDay", typeof(string));
                dataTable.Columns.Add("address", typeof(string));
                dataTable.Columns.Add("phoneNumber", typeof(string));
                dataTable.Columns.Add("email", typeof(string));
                dataTable.Columns.Add("dayAtWork", typeof(string));
                dataTable.Columns.Add("statusOfWork", typeof(bool));
                dataTable.Columns.Add("nameOffice", typeof(string));

                OfficeService officeService = new OfficeService(_context);

                dataTable = tables as DataTable;
                int i = 0;
                foreach (DataRow item in dataTable.Rows)
                {
                    Guid     Id           = new Guid(item.Table.Rows[i]["Id"].ToString());
                    string   username     = item.Table.Rows[i]["userName"].ToString();
                    string   password     = item.Table.Rows[i]["password"].ToString();
                    string   fullName     = item.Table.Rows[i]["fullName"].ToString();
                    bool     sex          = (bool)item.Table.Rows[i]["sex"];
                    DateTime birthDay     = Convert.ToDateTime(item.Table.Rows[i]["birthDay"].ToString());
                    string   address      = item.Table.Rows[i]["address"].ToString();
                    string   phoneNumber  = item.Table.Rows[i]["phoneNumber"].ToString();
                    string   email        = item.Table.Rows[i]["email"].ToString();
                    DateTime dayAtWork    = Convert.ToDateTime(item.Table.Rows[i]["dayAtWork"].ToString());
                    bool     statusOfWork = (bool)(item.Table.Rows[i]["statusOfWork"]);
                    string   nameOffice   = item.Table.Rows[i]["nameOffice"].ToString();

                    Office off = officeService.GetOffice(nameOffice);
                    if (off != null)
                    {
                        var user = _context.Employes.Where(x => x.Id == Id).Include(x => x.Offices).SingleOrDefault();
                        user.userName = username;
                        if (user.password != password)
                        {
                            user.password = GenerateHash.Instance.ComputeSha256Hash(password);
                        }
                        user.fullName     = fullName;
                        user.sex          = sex;
                        user.birthDay     = birthDay;
                        user.address      = address;
                        user.phoneNumber  = phoneNumber;
                        user.email        = email;
                        user.dayAtWork    = dayAtWork;
                        user.statusOfWork = statusOfWork;
                        user.Offices      = off;
                        _context.SaveChanges();
                    }
                    i++;
                }
                return(true);
            }
            catch (Exception)
            {
            }
            return(false);
        }