public static ResponseListDTO <T> Return(IEnumerable <T> entity, string methodName) { string message = string.Empty; if (entity.Count() > 0) { message = ResponseMessage.GetDescription(ResponseMessage.Success, methodName); } else { message = ResponseMessage.GetDescription(ResponseMessage.NotFound, methodName); } ResponseListDTO <T> response = new ResponseListDTO <T> { Data = entity, Message = message, Information = new Information { TrackId = Guid.NewGuid().ToString() }, RC = entity == null ? ResponseMessage.NotFound : ResponseMessage.Success }; Log.Write(LogEventLevel.Information, message, response); return(response); }
/// <summary> /// Obtiene el listado de categorias disponibles /// </summary> /// <param name="filter"></param> /// <returns></returns> public ResponseListDTO <CategoriesDTO> CategoriesGetFilteredList(RequestDTO <CategoriesDTO> filter) { var response = new ResponseListDTO <CategoriesDTO>(); try { response.Result = categoriesDataLayer.CategoriesGetFilteredList(filter); response.Success = response.Result.Any(); } catch (Exception exception) { throw; } return(response); }
/// <summary> /// Obtiene el listado de secciones por platillo /// </summary> /// <param name="dishIdentifier"></param> /// <returns></returns> public ResponseListDTO <DishSectionsDTO> DishSectionsByDishGetList(long dishIdentifier) { var dishSectionsResponse = new ResponseListDTO <DishSectionsDTO>(); try { dishSectionsResponse.Result = dishesDataLayer.DishSectionsByDishGetList(dishIdentifier); dishSectionsResponse.Success = dishSectionsResponse.Result.Any(); } catch (Exception) { throw; } return(dishSectionsResponse); }
/// <summary> /// Permite obtener listado de platillos por categoría /// </summary> /// <param name="categoryIdentifier"></param> /// <returns></returns> public ResponseListDTO <DishesDTO> DishesByCategoryGetList(int categoryIdentifier) { var dishesByCategoryResponse = new ResponseListDTO <DishesDTO>(); try { dishesByCategoryResponse.Result = dishesDataLayer.DishesByCategoryGetList(categoryIdentifier); dishesByCategoryResponse.Success = dishesByCategoryResponse.Result.Any(); } catch (Exception exception) { throw; } return(dishesByCategoryResponse); }
public ResponseListDTO <DishComplementsDTO> DishComplementsGetFilteredList(RequestDTO <DishesDTO> filter) { var dishComplementsResponse = new ResponseListDTO <DishComplementsDTO>(); try { dishComplementsResponse.Result = dishesDataLayer.DishComplementsGetFilteredList(filter.Item.DishIdentifier, filter.Item.DishSectionsList.FirstOrDefault().DishSectionId); dishComplementsResponse.Success = dishComplementsResponse.Result != null && dishComplementsResponse.Result.Any(); } catch (Exception exception) { throw; } return(dishComplementsResponse); }
/// <summary> /// Obtiene un listado de complementos por platillo y seccion /// </summary> /// <param name="dishIdentifier"></param> /// <param name="dishSectionIdentifier"></param> /// <returns></returns> public ResponseListDTO <DishComplementsDTO> DishComplementsGetFilteredList(long dishIdentifier, int dishSectionIdentifier) { var dishComplementsResponse = new ResponseListDTO <DishComplementsDTO> { Result = new List <DishComplementsDTO>() }; try { dishComplementsResponse.Result = dishesDataLayer.DishComplementsGetFilteredList(dishIdentifier, dishSectionIdentifier); dishComplementsResponse.Success = dishComplementsResponse.Result.Any(); } catch (Exception exception) { throw; } return(dishComplementsResponse); }