在服务器上传时,然后响应500内部服务器错误

时间:2015-12-07 07:02:03

标签: angularjs asp.net-mvc

它没有受到服务和控制台的攻击无法加载资源:服务器响应状态为500(内部服务器错误)

http://newalturathadmin.alturath.net/api/ApiFailureDonatorMobile?currentPage=1&recordsPerPage=20&Name=&DateFrom=&DateTo=

public class ApiFailureDonatorMobileController:Application.Global.BaseControllers.ApiControllerBase     {         DateTime frmDate;         DateTime toDate;

    public HttpResponseMessage Get(int currentPage, int recordsPerPage, string Name = "", string DateFrom = "", string DateTo = "")
    {


        try
        {
            var dataEntryQuery = OUnitOfWork.FailureDonatorRepository.GetAll().OrderByDescending(x => x.Id);

            if (DateFrom != null || DateTo != null)
            {
                 frmDate = DateTime.ParseExact(DateFrom, "dd-MM-yyyy", CultureInfo.InvariantCulture);

                if (DateTo != null)
                 {
                      toDate = DateTime.ParseExact(DateTo, "dd-MM-yyyy", CultureInfo.InvariantCulture);

                 }





                toDate = toDate.AddDays(1);
                dataEntryQuery = dataEntryQuery.Where(x =>
                                                       (


                                                           (!string.IsNullOrEmpty(Name.Trim()) ?
                                                          (!string.IsNullOrEmpty(x.Project.ProjectName.Trim()) ? x.Project.ProjectName.Contains(Name.Trim()) : 1 == 2) : 1 == 1)


                                                           && x.Createdon >= (string.IsNullOrEmpty(DateFrom) ? x.Createdon : frmDate.Date)
                                                           && x.Createdon <= (string.IsNullOrEmpty(DateTo) ? x.Createdon : toDate.Date)

                                                        )).OrderByDescending(x => x.Id);



            }
            else
            {

                dataEntryQuery = dataEntryQuery.Where(x =>
                                                       (
                                                        (!string.IsNullOrEmpty(Name.Trim()) ?
                                                          (!string.IsNullOrEmpty(x.Project.ProjectName.Trim()) ? x.Project.ProjectName.Contains(Name.Trim()) : 1 == 2) : 1 == 1)
                                                        )).OrderByDescending(x => x.Id);



            }


            var _totalCount = dataEntryQuery.Count();
            var _totalPages = Math.Ceiling((double)_totalCount / recordsPerPage);

            var entries = dataEntryQuery.Skip((currentPage - 1) * recordsPerPage)
                                    .Take(recordsPerPage)
                                    .AsQueryable();

            var includeMastersName = (from x in entries.AsEnumerable()

                                      select new
                                      {

                                          Id = x.Id,
                                          Project = x.Project_FK_ID == null ? "" : x.Project.ProjectName,
                                          InvoiceId = x.InvoiceId,
                                          MobileNo = x.MobileNo,
                                          Createdon = x.Createdon,


                                      }).AsQueryable();

            var result = new
            {
                TotalCount = _totalCount,
                TotalPages = _totalPages,
                AllEntries = includeMastersName
            };

            return Request.CreateResponse(HttpStatusCode.OK, result);




        }
        catch (Exception e)
        {
            return Request.CreateResponse(HttpStatusCode.InternalServerError, e.Message + "-------" + e.InnerException.Message + "-------" + e.StackTrace + "-------" + e.Source); ;
        }
        return Request.CreateResponse(HttpStatusCode.NotFound, new { resul = "Error" });


    }









}

0 个答案:

没有答案