/// <summary> /// Get all itens filtering direct in DB. Up: More optimized because filters DB. Down: less flexible, don't support dynamic filters. /// </summary> /// <param name="generalBodyGet"></param> /// <param name="error"></param> /// <returns></returns> public List <GetRegionView> GetAllWithDBFilter(GeneralBodyGet generalBodyGet, out RestExceptionError error) { try { if ((generalBodyGet == null) || (generalBodyGet.Filters == null) || (generalBodyGet.Filters.Count == 0)) { error = new RestExceptionError(); error.ExceptionMessage = ""; error.InternalMessage = "Url does not contains filter section"; } error = null; RegionBsn bsn = new RegionBsn(restConfig); List <DataFilterExpressionDB> dbFilter = HelperRESTFilterToDB.FilterRestFilterToDBExpression(generalBodyGet.Filters); List <RegionInfo> dbItems = bsn.GetAll(dbFilter); List <GetRegionView> result = new List <GetRegionView>(); foreach (RegionInfo item in dbItems) { GetRegionView view = new GetRegionView(); Cloner.CopyAllTo(typeof(RegionInfo), item, typeof(GetRegionView), view); result.Add(view); } return(result); } catch (Exception ex) { error = new RestExceptionError(); error.ExceptionMessage = ex.Message; } return(null); }
public ModelNotifiedForRegion GetRegionByID(int RegionID, out string error) { error = null; RegionGenericREST RegionGenericREST = new RegionGenericREST(wpfConfig); GetRegionView getRegionView = RegionGenericREST.GetByPK <GetRegionView>(RegionID, out error)[0]; ModelNotifiedForRegion modelNotifiedForRegion = new ModelNotifiedForRegion(); Cloner.CopyAllTo(typeof(GetRegionView), getRegionView, typeof(ModelNotifiedForRegion), modelNotifiedForRegion); return(modelNotifiedForRegion); }
public List <GetRegionView> GetAll(out RestExceptionError error) { try { error = null; RegionBsn bsn = new RegionBsn(restConfig); List <RegionInfo> dbItems = bsn.GetAll(); List <GetRegionView> result = new List <GetRegionView>(); foreach (RegionInfo item in dbItems) { GetRegionView view = new GetRegionView(); Cloner.CopyAllTo(typeof(RegionInfo), item, typeof(GetRegionView), view); result.Add(view); } return(result); } catch (Exception ex) { error = new RestExceptionError(); error.ExceptionMessage = ex.Message; } return(null); }