示例#1
0
 public IActionResult GetSortedOrFilteredData([FromBody] StatusCriteria data)
 {
     if (data.Criteria == "price")
     {
         return(Ok(_context.GetBikeOrderByHourPrice()));
     }
     else if (data.Criteria == "validStatus")
     {
         return(Ok(_context.GetBikeOrderByStatus()));
     }
     else if (data.Criteria == "invalidStatus")
     {
         return(Ok(_context.GetBikeOrderByInvalidState()));
     }
     else if (data.Criteria == "priceDay")
     {
         return(Ok(_context.GetBikeOrderByDayPrice()));
     }
     else if (data.Criteria == "employee")
     {
         return(Ok(second_context.GetOrdersForEmployee(data.Id)));
     }
     else
     {
         return(BadRequest("invalid criteria"));
     }
 }