public Response Update(Request <MealTypeUpdate> request) { try { ValidateBaseRequest(request); var mealTypeService = MealTypeService.GetInstance(); return(mealTypeService.Update(request)); } catch (RestaurantException ex) { return(new Response { ErrorCode = ex.ErrorCode }); } catch (Exception e) { return(new Response { ErrorCode = new ErrorCode { ErrorMessage = e.Message, ErrorNumber = ErrorNumber.GeneralError } }); } }
public static List <MealType> GetMealTypes(Request <MealTypeList> request) { try { if (MealTypes == null) { var mealTypeService = MealTypeService.GetInstance(); var response = mealTypeService.List(new Request()); MealTypes = response.Data; } Request <BaseList> baseFilter; if (request == null || request.Data == null) { baseFilter = new Request <BaseList> { Data = new BaseList() } } ; else { baseFilter = new Request <BaseList> { Data = request.Data } }; return(MealTypes.Where(m => CheckBasicFilter(m, baseFilter) && (request == null || request.Data == null || !request.Data.BranchId.HasValue || m.BranchId == request.Data.BranchId)) .ToList()); } catch (RestaurantException ex) { throw ex; } catch (Exception e) { throw e; } }