public ModifyPosSimProviderResponse ModifyPosSimProvider(ModifyPosSimProviderRequest request) { ModifyPosSimProviderResponse response = new ModifyPosSimProviderResponse(); PosSimProvider posSimProvider = _posSimProviderRepository .FindBy(request.SimProviderId); posSimProvider.Id = request.SimProviderId; posSimProvider.SimProviderName = request.SimProviderName; posSimProvider.PosSims = request.PosSims.ConvertToPosSims(); if (posSimProvider.GetBrokenRules().Count() > 0) { response.Errors = posSimProvider.GetBrokenRules().ToList(); } else { try { _posSimProviderRepository.Save(posSimProvider); _uow.Commit(); response.Errors = new List <BusinessRule>(); } catch (Exception ex) { response.Errors = new List <BusinessRule>(); response.Errors.Add(new BusinessRule("DAL", "DAL_ERROR: " + ex.Message)); } } return(response); }
public CreatePosSimProviderResponse CreatePosSimProvider(CreatePosSimProviderRequest request) { CreatePosSimProviderResponse response = new CreatePosSimProviderResponse(); PosSimProvider posSimProvider = new PosSimProvider(); posSimProvider.SimProviderName = request.SimProviderName; posSimProvider.PosSims = request.PosSims.ConvertToPosSims(); if (posSimProvider.GetBrokenRules().Count() > 0) { response.Errors = posSimProvider.GetBrokenRules().ToList(); } else { try { _posSimProviderRepository.Add(posSimProvider); _uow.Commit(); response.Errors = new List <BusinessRule>(); } catch (Exception ex) { List <BusinessRule> errors = new List <BusinessRule>(); do { errors.Add(new BusinessRule("DAL", "DAL_ERROR: " + ex.Message)); ex = ex.InnerException; } while (ex != null); response.Errors = errors; } } return(response); }
public GetPosSimProviderResponse GetPosSimProvider(GetPosSimProviderRequest request) { GetPosSimProviderResponse response = new GetPosSimProviderResponse(); PosSimProvider posSimProvider = _posSimProviderRepository .FindBy(request.SimProviderId); if (posSimProvider != null) { response.PosSimProviderFound = true; response.PosSimProvider = posSimProvider.ConvertToPosSimProviderView(); } else { response.PosSimProviderFound = false; } return(response); }
public static PosSimProviderView ConvertToPosSimProviderView( this PosSimProvider posSimProvider) { return(Mapper.Map <PosSimProvider, PosSimProviderView>(posSimProvider)); }