public void UpdateBrand(BrandViewModel brand)
 {
     Brand entity = _brandRepository.GetById<int>(brand.Id);
     Map(brand, entity);
     _brandRepository.Update(entity);
     _unitOfWork.SaveChanges();
 }
 public void DeleteBrand(BrandViewModel brand)
 {
     Brand selectedBrand = _brandRepository.GetById<int>(brand.Id);
     selectedBrand.Status = (int)DbConstant.DefaultDataStatus.Deleted;
     _brandRepository.Update(selectedBrand);
     _unitOfWork.SaveChanges();
 }
        public void InsertBrand(BrandViewModel brand)
        {
            brand.Status = (int)DbConstant.DefaultDataStatus.Active;
            using (var trans = _unitOfWork.BeginTransaction())
            {
                try
                {
                    Brand entity = new Brand();
                    Map(brand, entity);
                    _brandRepository.Add(entity);
                    _unitOfWork.SaveChanges();

                    trans.Commit();
                }
                catch (System.Exception ex)
                {
                    trans.Rollback();
                    throw ex;
                }
            }
        }
 public override void RefreshDataView()
 {
     if (!bgwMain.IsBusy)
     {
         MethodBase.GetCurrentMethod().Info("Fecthing brand data...");
         _selectedBrand = null;
         FormHelpers.CurrentMainForm.UpdateStatusInformation("Memuat data brand...", false);
         bgwMain.RunWorkerAsync();
     }
 }