public ActionResult StudentInfo() { Student s = new Student(); s.StudentFirstName="devendranath"; s.StudentLastName = "vaggalla"; s.StudentClg = "NextGen"; s.ParentSalary = 10000; StudentViewModel svm = new StudentViewModel(); svm.StudentName = s.StudentFirstName + " " + s.StudentLastName; svm.StudentClg = s.StudentClg; svm.SalaryOfParent = s.ParentSalary.ToString("C"); if (s.ParentSalary > 5000) { svm.SalaryColor = "red"; } else svm.SalaryColor = "green"; return View("StudentInfo", svm); }
public ActionResult GetViewBag() { Student stdnt = new Student(); stdnt.StudentNo = 1; stdnt.StudentFirstName = "siva kumar"; stdnt.StudentClg = "CBIT"; ViewBag.student = stdnt; return View("Student"); }