Example #1
0
 public ActionResult Create(FormCollection formData)
 {
     Student s = new Student(); UpdateModel(s);
     StudentRepository repository = new StudentRepository();
     repository.AddStudent(s);
     return RedirectToAction("Index");
 }
Example #2
0
        public ActionResult Edit(int? id)
        {
            if(id != null)
            {
                StudentRepository repository = new StudentRepository();
                var model = repository.GetStudentById(id.Value);
                return View(model);
            }

            return View();     
        }
Example #3
0
		public ActionResult Edit(int? id)
		{
			if (id.HasValue)
			{
				int theID = id.Value;
				StudentRepository repository = new StudentRepository();
				Student model = repository.GetStudentById(theID);

				if (model == null)
					return View("NotFound");
				return View(model);
			}
			else
Example #4
0
 public ActionResult Edit(int id, FormCollection formData)
 {
     StudentRepository repository = new StudentRepository();
     Student s = repository.GetStudentById(id);
     if (s != null)
     {
         UpdateModel(s); repository.UpdateStudent(s);
         return RedirectToAction("Index");
     }
     else
     {
         return View("NotFound");
     }
 }
Example #5
0
		public ActionResult Index()
		{
			StudentRepository repository = new StudentRepository();
			var model = repository.GetAllStudents();
			return View(model);
		}