Ejemplo n.º 1
0
 public IActionResult ListCampaigns(string campaign_category_id, string status, string name, string start_date, string end_date, string region_id)
 {
     try
     {
         if ((!string.IsNullOrEmpty(start_date) && !_validate.IsDate(start_date)) || (!string.IsNullOrEmpty(end_date) && !_validate.IsDate(end_date)))
         {
             return(StatusCode(400, new { code = 400, message = "Invalid date", data = (object)null }));
         }
         var data = _campaign.ListCampaigns(campaign_category_id, status, name, start_date, end_date, region_id);
         var json = JsonConvert.SerializeObject(data);
         return(Content(json, "application/app"));
     }
     catch (Exception e)
     {
         return(StatusCode(400, new { code = 400, message = e.Message, data = (object)null }));
     }
 }