public APIGatewayProxyResponse GetCategory(APIGatewayProxyRequest request) { if (request.PathParameters != null && request.PathParameters.ContainsKey("categoryId") && int.TryParse(request.PathParameters["categoryId"], out var categoryId)) { var onlineFoodContext = new OnlineFoodContext(); var categoryService = new CategoryService(onlineFoodContext); var getCategory = categoryService.GetCategory(categoryId); return(new APIGatewayProxyResponse { StatusCode = (int)HttpStatusCode.OK, Body = JsonConvert.SerializeObject(getCategory) }); } return(new APIGatewayProxyResponse { StatusCode = (int)HttpStatusCode.NotFound }); }
public CategoryService(OnlineFoodContext onlineFoodContext) { _onlineFoodContext = onlineFoodContext; }
public SettingRepository(OnlineFoodContext context) { _context = context ?? throw new ArgumentNullException(nameof(context)); }