public ModifyPosStatusSimResponse ModifyPosStatusSim(ModifyPosStatusSimRequest request) { ModifyPosStatusSimResponse response = new ModifyPosStatusSimResponse(); PosStatusSim posStatusSim = _posStatusSimRepository .FindBy(request.StatusId); posStatusSim.Id = request.StatusId; posStatusSim.StatusName = request.StatusName; posStatusSim.PosSims = request.PosSims.ConvertToPosSims(); if (posStatusSim.GetBrokenRules().Count() > 0) { response.Errors = posStatusSim.GetBrokenRules().ToList(); } else { try { _posStatusSimRepository.Save(posStatusSim); _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 CreatePosStatusSimResponse CreatePosStatusSim(CreatePosStatusSimRequest request) { CreatePosStatusSimResponse response = new CreatePosStatusSimResponse(); PosStatusSim posStatusSim = new PosStatusSim(); posStatusSim.StatusName = request.StatusName; posStatusSim.PosSims = request.PosSims.ConvertToPosSims(); if (posStatusSim.GetBrokenRules().Count() > 0) { response.Errors = posStatusSim.GetBrokenRules().ToList(); } else { try { _posStatusSimRepository.Add(posStatusSim); _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 GetPosStatusSimResponse GetPosStatusSim(GetPosStatusSimRequest request) { GetPosStatusSimResponse response = new GetPosStatusSimResponse(); PosStatusSim posStatusSim = _posStatusSimRepository .FindBy(request.StatusId); if (posStatusSim != null) { response.PosStatusSimFound = true; response.PosStatusSim = posStatusSim.ConvertToPosStatusSimView(); } else { response.PosStatusSimFound = false; } return(response); }
public static PosStatusSimView ConvertToPosStatusSimView( this PosStatusSim posStatusSim) { return(Mapper.Map <PosStatusSim, PosStatusSimView>(posStatusSim)); }