Hi Sir,
Can u plzz check this one..
i am sending my whole code can u plz check its urgent.. in post method plz check i m not getting that update query
View:
@using MyDemoProject.Models
@model DetailsList
@foreach (var item in Model)
{
@Html.DisplayFor(modelItem => item.Id)
@Html.DisplayFor(modelItem => item.Name)
@Html.DisplayFor(modelItem => item.OldSeq)
}
model
public class EmpDetails
{
public int Id { get; set; }
public string Name { get; set; }
public int OldSeq { get; set; }
public int NewSeq { get; set; }
}
public class DetailsList
{
public int Id { get; set; }
public string Name { get; set; }
public int OldSeq { get; set; }
public int NewSeq { get; set; }
public IEnumerable EmpDetailsList { get; set; }
}
Controller
projectEntities obj = new projectEntities();
[HttpGet]
public ActionResult EmployeeDetails()
{
List c2 = new List();
EmpDetails model = new EmpDetails();
var Empdet = from x in obj.Employees
//where x.Id==model.Id
select x;
foreach(var item in Empdet)
{
model = new EmpDetails();
model.Id = item.Id;
model.Name = item.Name;
model.OldSeq = Convert.ToInt16(item.OldSeq);
model.NewSeq = Convert.ToInt16(item.NewSeq);
c2.Add(model);
}
DetailsList abc = new DetailsList();
abc.EmpDetailsList = c2;
return View(c2);
}
[HttpPost]
public ActionResult EmployeeDetails(DetailsList model)
{
List results =
(from p in obj.Employees
where p.Id == model.Id
select p).ToList();
foreach (EmpDetails p in results)
{
p.is_default = false;
}
obj.SaveChanges();
return View();
}
}

Francis SusaimichaelRank #466 · 5.4K reputationPosted Oct 12, 2015, 1:21 AM EDT
Harpreet60 reputationPosted Oct 12, 2015, 1:32 AM EDT
Ravi PatelRank #439 · 5.7K reputationPosted Oct 12, 2015, 2:04 AM EDT
Mukesh KumarRank #119 · 18.2K reputationPosted Oct 12, 2015, 2:10 AM EDT
Harpreet60 reputationPosted Oct 12, 2015, 2:13 AM EDT
Harpreet60 reputationPosted Oct 12, 2015, 2:27 AM EDT
Harpreet60 reputationPosted Oct 12, 2015, 2:27 AM EDT
Ravi PatelRank #439 · 5.7K reputationPosted Oct 12, 2015, 2:38 AM EDT
Harpreet60 reputationPosted Oct 12, 2015, 2:45 AM EDT
Mukesh KumarRank #119 · 18.2K reputationPosted Oct 12, 2015, 2:52 AM EDT
Harpreet60 reputationPosted Oct 12, 2015, 2:56 AM EDT
Harpreet60 reputationPosted Oct 12, 2015, 7:50 PM EDT