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();
}
}
HarpreetPosted Oct 12, 2015, 11:50 PM
HarpreetPosted Oct 12, 2015, 6:56 AM
Mukesh KumarPosted Oct 12, 2015, 6:52 AM
HarpreetPosted Oct 12, 2015, 6:45 AM
Ravi PatelPosted Oct 12, 2015, 6:38 AM
HarpreetPosted Oct 12, 2015, 6:27 AM
HarpreetPosted Oct 12, 2015, 6:27 AM
HarpreetPosted Oct 12, 2015, 6:13 AM
Mukesh KumarPosted Oct 12, 2015, 6:10 AM
Ravi PatelPosted Oct 12, 2015, 6:04 AM
HarpreetPosted Oct 12, 2015, 5:32 AM
Francis SusaimichaelPosted Oct 12, 2015, 5:21 AM