using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using TestProjectMvc.Models; using PagedList; using PagedList.Mvc; namespace TestProjectMvc.Controllers { public class HomeController : Controller {
public ActionResult Index() { UserViewModel obj = new UserViewModel(); UserBAL user = new UserBAL(); obj.UserList = user.GetListRecord(user).ToPagedList(1, 2); return View(obj); }
public ActionResult Edit(int id) { UserViewModel obj = new UserViewModel(); UserBAL user = new UserBAL(); user.UserId = id; user.EditRecord(user); obj.User = user; return PartialView("_AddUser", obj); }
[HttpPost] public ActionResult Edit(UserViewModel data) { UserViewModel obj = new UserViewModel(); UserBAL user = new UserBAL(); if (ModelState.IsValid) { if (Request.IsAjaxRequest()) { user.InsertUpdateRecord(data.User); } } return new EmptyResult();
}
} }
Liked By
Write Answer
How to edit update record in mvc Using Ajax.
Join MindStick Community
You have need login or register for voting of answers or question.
Anonymous User
19-Nov-2015