public HttpResponseMessage GetProductVoteReport() { return SafeAction(() => { IDelightServices service = new DelightServices(); var report = service.GetProductVoteReport(); if (report == null) { return Request.CreateResponse(HttpStatusCode.NoContent); } var file = DateTime.Now.Ticks.ToString(); var path = Path.Combine(HostingEnvironment.MapPath("~/Content/Files"), file) + ".xls"; GenerateReport(path, report); var response = Request.CreateResponse<ChartModel>(HttpStatusCode.OK, new ChartModel() { Report = report, Url = Path.Combine("/Content/Files", file) + ".xls" }); return response; }); }