- MVCJqGridCrud_-_CSharp_-_Solution.zip
- MVCJqGridCrud - CSharp - Solution
- _ReSharper.MVCJqGridCrud
- BuildScriptCache
- .crc
- .version
- 7
- 4819a3a5.dat
- DecompilerCache
- NamedArguments
- .crc
- .version
- 1
- 62e4ccca.dat
- PdbInfo
- ProjectModel
- ProjectModel.dat
- Resources
- .crc
- .version
- SymbolCache.bin
- TagPrefixes
- .crc
- .version
- 2
- 2d4e7a80.dat
- TodoCache
- .crc
- .version
- 5
- 7b76c216.dat
- WebsiteFileReferences
- .crc
- .version
- WordIndex
- .crc
- .version
- 7
- 4a52d77e.dat
- BLL
- Core
- JqGridCRUD.Tests
- JqGridCRUD
- MVCJqGridCrud.5.1.ReSharper.user
- MVCJqGridCrud.sln
- MVCJqGridCrud.suo
- packages
- EntityFramework.4.1.10331.0
- EntityFramework.4.1.10331.0.nupkg
- lib
- jQuery.1.5.1
- Content
- Scripts
- jQuery.1.5.1.nupkg
- jQuery.UI.Combined.1.8.11
- Content
- Content
- themes
- base
- Scripts
- jQuery.UI.Combined.1.8.11.nupkg
- jQuery.Validation.1.8.0
- Content
- Scripts
- jQuery.Validation.1.8.0.nupkg
- jQuery.vsdoc.1.5.1
- Content
- Scripts
- jQuery.vsdoc.1.5.1.nupkg
- Modernizr.1.7
- Content
- Scripts
- Modernizr.1.7.nupkg
- repositories.config
- ProgrammingEFDB1-Database.zip
- ProgrammingEFDB1-Database
- ProgrammingEFDB1
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using BLL;
using DAL;
namespace JqGridCRUD.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.Message = "Welcome to ASP.NET MVC!";
return View();
}
public ActionResult About()
{
return View();
}
public ActionResult GridDemoData(int page, int rows, string search, string sidx, string sord)
{
var manageContacts = new ManageContacts();
int currentPage = Convert.ToInt32(page) - 1;
int totalRecords = 0;
var data = manageContacts.GetContactPaged(currentPage, rows, out totalRecords);
var totalPages = (int)Math.Ceiling(totalRecords / (float)rows);
var jsonData = new
{
total = totalPages,
page,
records = totalRecords,
rows = (
from m in data
select new
{
id = m.ContactID,
cell = new object[]
{
m.Title,
m.FirstName,
m.LastName
}
}).ToArray()
};
return Json(jsonData, JsonRequestBehavior.AllowGet);
}
public ActionResult PerformCRUDAction(Contact contact)
{
var manageContacts = new ManageContacts();
bool result = false;
switch (Request.Form["oper"])
{
case "add":
contact.AddDate = DateTime.Now.Date;
contact.ModifiedDate = DateTime.Now;
result = manageContacts.AddContact(contact);
break;
case "edit":
int id = Int32.Parse(Request.Form["id"]);
result = manageContacts.UpdateContact(contact,id);
break;
case "del":
id = Int32.Parse(Request.Form["id"]);
result = manageContacts.DeleteContact(id);
break;
default:
break;
}
return Json(result);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
i am working as a senior software developer.
aamirposwal.blogspot.com