TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Yogesh Vedpathak
670
1.4k
197.8k
CS0103 The name json doesnot exist in current context .
Dec 15 2017 1:44 AM
using DemoGrids.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Data.Entity;
using System.Text;
namespace DemoGrids.BussinessService
{
public class BussinessServices
{
public JsonResult GetCustomers(String Word, int Page, int rows, string searchString)
{
using (DatabaseContext db = new DatabaseContext())
{
int PageIndex = Convert.ToInt32(Page) - 1;
int PageSize = rows;
string sort = string.Empty;
var Results = db.Customers.Select(
a => new
{
a.CustomerID,
a.ContactName,
a.ContactTitle,
a.City,
a.PostalCode,
a.Country,
a.Phone,
}).ToList();
int totalRecords = Results.Count();
var totalPages = (int)Math.Ceiling((float)totalRecords / (float)rows);
if (sort.ToUpper() == "DESC")
{
Results = Results.OrderByDescending(s => s.CustomerID).ToList();
Results = Results.Skip(PageIndex * PageSize).Take(PageSize).ToList();
}
else
{
Results = Results.OrderBy(s => s.CustomerID).ToList();
Results = Results.Skip(PageIndex * PageSize).Take(PageSize).ToList();
}
if (!string.IsNullOrEmpty(searchString))
{
Results = Results.Where(m => m.Country == searchString).ToList();
}
var jsonData = new
{
total = totalPages,
Page,
records = totalRecords,
rows = Results
};
return Json(jsonData, JsonRequestBehavior.AllowGet); // error here
}
}
}
}
Reply
Answers (
2
)
How to upload cad files on FME server using WEB API?
installing some nuget package check Jquery