change the return view fields after insert data
In my controller class,
public ActionResult Index()
{
return View(db.Schools.ToList());
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "SchoolId,SchoolType,SchoolName")] SchoolModels schoolModels)
{
schoolModels.Status = 1;
schoolModels.RegDate = DateTime.Now.ToString();
schoolModels.ModifiedDate = null;
if (ModelState.IsValid)
{
db.Schools.Add(schoolModels);
db.SaveChanges();
return RedirectToAction("Index");
}
return View(schoolModels);
}
After successfull insert, the Index page shows all the column values,
SchoolType,SchoolName,Status,RegDate,ModifiedDate
But I want to display only SchoolType,SchoolName,Status these columns. And for the value of Status it should be:
if Status = 1 display ACTIVE; if Status = 2 display HOLD if Status = 3 display COMPLETED.
How can I do this?