using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using RegisterStudy.Models;
using System.Data.Linq;
namespace RegisterStudy.Controllers
{
public class RegisterController : Controller
{
private RegisterRepository rr = new RegisterRepository();
public ActionResult Index()
{
var regises = rr.FindAllRegister().ToList();
return View();
}
public ActionResult Details(int id)
{
Student stu = rr.GetRegister(id);
return View(stu);
}
public ActionResult Regisstudy(int id)
{
Student stu = rr.GetRegister(id);
return View(stu);
}
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Details(int stu_id, FormCollection formValues)
{
Student stu = rr.GetRegister(stu_id);
return RedirectToAction("Details", new { id = stu.Stu_id });
}
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Regisstudy(int id, FormCollection formValues)
{
ViewModels.RegisterViewModels registerViewModels = new RegisterStudy.ViewModels.RegisterViewModels();
registerViewModels.Stuname = rr.GetRegister(id);
registerViewModels.SubjList = rr.GetList();
return RedirectToAction("Regisstudy", new { id = registerViewModels.Stuname.Stu_id });
}
public ActionResult ListSubject()
{
ViewModels.SubjectViewModels subjectViewModel = new RegisterStudy.ViewModels.SubjectViewModels();
subjectViewModel.SubjList = rr.GetList();
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace RegisterStudy.ViewModels
{
public class RegisterViewModels
{
public RegisterViewModels()
{
Stuname = new RegisterStudy.Models.Student();
SubjList = new List<RegisterStudy.Models.Subject>();
}
public RegisterStudy.Models.Student Stuname{ set; get; }
public List<RegisterStudy.Models.Subject> SubjList { set; get; }