public bool DeleteCompany(PersonType company)
 {
     try
     {
         using (SalesAndInventorySystemDataContext dataContext = new SalesAndInventorySystemDataContext())
         {
             dataContext.Companies.Attach(company);
             dataContext.Entry(company).State=EntityState.Deleted;
             dataContext.SaveChanges();
             return true;
         }
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message);
     }
 }
 public bool DeleteProduct(Product product)
 {
     try
     {
         using (SalesAndInventorySystemDataContext dataContext = new SalesAndInventorySystemDataContext())
         {
             dataContext.Products.Attach(product);
             dataContext.Entry(product).State = EntityState.Deleted;
             dataContext.SaveChanges();
             return true;
         }
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message);
     }
 }
        public bool UpdateCompany(PersonType company)
        {
            try
            {
                using (SalesAndInventorySystemDataContext dataContext = new SalesAndInventorySystemDataContext())
                {
                    dataContext.Companies.Attach(company);
                    dataContext.Entry(company).State = EntityState.Modified;
                    dataContext.SaveChanges();
                    return true;

                    //_cnt.Users.Attach(user);
                    //_cnt.Entry<User>(user).Property(u => u.PasswordHash).IsModified = true;
                    //_cnt.SaveChanges();
                }
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
        }
 public bool UpdateCategory(Category category)
 {
     try
     {
         using (SalesAndInventorySystemDataContext dataContext = new SalesAndInventorySystemDataContext())
         {
             dataContext.Categoets.Attach(category);
             dataContext.Entry(category).State = EntityState.Modified;
             dataContext.SaveChanges();
             return true;
         }
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message);
     }
 }