public void UpdateType(TypeViewModel type)
 {
     Type entity = _typeRepository.GetById<int>(type.Id);
     Map(type, entity);
     _typeRepository.Update(entity);
     _unitOfWork.SaveChanges();
 }
        public void InsertType(TypeViewModel type)
        {
            type.Status = (int)DbConstant.DefaultDataStatus.Active;
            using (var trans = _unitOfWork.BeginTransaction())
            {
                try
                {
                    Type entity = new Type();
                    Map(type, entity);
                    _typeRepository.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 type data...");
         _selectedType = null;
         FormHelpers.CurrentMainForm.UpdateStatusInformation("Memuat data type...", false);
         bgwMain.RunWorkerAsync();
     }
 }