using StudentList.Models ;
using System;
using System.Collections .Generic ;
using System.Linq ;
using System.Security .Policy ;
using System.Web ;
using System.Web .Mvc ;
namespace StudentList.Controllers
{
public class HomeController : Controller
{
private Models.StudentListEntities db = new Models.StudentListEntities ( ) ;
public ActionResult Index( )
{
var students = db.Students ;
return View( students) ;
}
public ActionResult Registration( )
{
ViewBag.Message = "Tu możesz zarejestrować się" ;
return View( ) ;
}
public ActionResult Edit( )
{
ViewBag.Message = "Tu możesz edytować informację o Sobie" ;
return View( ) ;
}
public void Form( string Name, string Surname, string Qualification, string Specialty, double Rating)
{
Student student = new Student
{
Name = Name,
Surname = Surname,
Qualification = Qualification,
Specialty = Specialty,
Rating = Rating
} ;
db.Students .Add ( student) ;
db.SaveChanges ( ) ;
int studentId = db.Students .Max ( item => item.Id ) ;
Response.Cookies [ "StudentCookies" ] .Value = studentId.ToString ( ) ;
Response.Redirect ( "/" ) ;
}
public void EditForm( string Name, string Surname, string Qualification, string Specialty, double Rating)
{
string cookieReq = Request.Cookies [ "StudentCookies" ] .Value ;
if ( cookieReq != null )
{
string studentId = cookieReq;
int .Parse ( studentId) ;
}
}
}
}
dXNpbmcgU3R1ZGVudExpc3QuTW9kZWxzOwp1c2luZyBTeXN0ZW07CnVzaW5nIFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljOwp1c2luZyBTeXN0ZW0uTGlucTsKdXNpbmcgU3lzdGVtLlNlY3VyaXR5LlBvbGljeTsKdXNpbmcgU3lzdGVtLldlYjsKdXNpbmcgU3lzdGVtLldlYi5NdmM7CgoKbmFtZXNwYWNlIFN0dWRlbnRMaXN0LkNvbnRyb2xsZXJzCnsKICAgIHB1YmxpYyBjbGFzcyBIb21lQ29udHJvbGxlciA6IENvbnRyb2xsZXIKICAgIHsKICAgICAgICBwcml2YXRlIE1vZGVscy5TdHVkZW50TGlzdEVudGl0aWVzIGRiID0gbmV3IE1vZGVscy5TdHVkZW50TGlzdEVudGl0aWVzKCk7CgogICAgICAgIHB1YmxpYyBBY3Rpb25SZXN1bHQgSW5kZXgoKQogICAgICAgIHsKICAgICAgICAgICAgCiAgICAgICAgICAgIHZhciBzdHVkZW50cyA9IGRiLlN0dWRlbnRzOwogICAgICAgICAgICByZXR1cm4gVmlldyhzdHVkZW50cyk7CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgQWN0aW9uUmVzdWx0IFJlZ2lzdHJhdGlvbigpCiAgICAgICAgewogICAgICAgICAgICBWaWV3QmFnLk1lc3NhZ2UgPSAiVHUgbW/FvGVzeiB6YXJlamVzdHJvd2HEhyBzacSZIjsKCiAgICAgICAgICAgIHJldHVybiBWaWV3KCk7CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgQWN0aW9uUmVzdWx0IEVkaXQoKQogICAgICAgIHsKICAgICAgICAgICAgVmlld0JhZy5NZXNzYWdlID0gIlR1IG1vxbxlc3ogZWR5dG93YcSHIGluZm9ybWFjasSZIG8gU29iaWUiOwogICAgICAgICAgICAKICAgICAgICAgICAgCiAgICAgICAgICAgIHJldHVybiBWaWV3KCk7CiAgICAgICAgfQogICAgICAgIHB1YmxpYyB2b2lkIEZvcm0oc3RyaW5nIE5hbWUsIHN0cmluZyBTdXJuYW1lLCBzdHJpbmcgUXVhbGlmaWNhdGlvbiwgc3RyaW5nIFNwZWNpYWx0eSwgZG91YmxlIFJhdGluZykKICAgICAgICB7CiAgICAgICAgICAgIFN0dWRlbnQgc3R1ZGVudCA9IG5ldyBTdHVkZW50CiAgICAgICAgICAgIHsKICAgICAgICAgICAgTmFtZSA9IE5hbWUsCiAgICAgICAgICAgIFN1cm5hbWUgPSBTdXJuYW1lLAogICAgICAgICAgICBRdWFsaWZpY2F0aW9uID0gUXVhbGlmaWNhdGlvbiwKICAgICAgICAgICAgU3BlY2lhbHR5ID0gU3BlY2lhbHR5LAogICAgICAgICAgICBSYXRpbmcgPSBSYXRpbmcKICAgICAgICB9OwogICAgICAgICAgICBkYi5TdHVkZW50cy5BZGQoc3R1ZGVudCk7CiAgICAgICAgICAgIGRiLlNhdmVDaGFuZ2VzKCk7CgogICAgICAgICAgICBpbnQgc3R1ZGVudElkID0gIGRiLlN0dWRlbnRzLk1heChpdGVtID0+IGl0ZW0uSWQpOwogICAgICAgICAgICBSZXNwb25zZS5Db29raWVzWyJTdHVkZW50Q29va2llcyJdLlZhbHVlICA9IHN0dWRlbnRJZC5Ub1N0cmluZygpOwoKICAgICAgICAgICAgUmVzcG9uc2UuUmVkaXJlY3QoIi8iKTsKICAgICAgICB9CiAgICAgICAgcHVibGljIHZvaWQgRWRpdEZvcm0oc3RyaW5nIE5hbWUsIHN0cmluZyBTdXJuYW1lLCBzdHJpbmcgUXVhbGlmaWNhdGlvbiwgc3RyaW5nIFNwZWNpYWx0eSwgZG91YmxlIFJhdGluZykKICAgICAgICB7CgogICAgICAgICAgICBzdHJpbmcgY29va2llUmVxID0gUmVxdWVzdC5Db29raWVzWyJTdHVkZW50Q29va2llcyJdLlZhbHVlOwogICAgICAgICAgICAKICAgICAgICAgICAgaWYgKGNvb2tpZVJlcSAhPSBudWxsKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzdHJpbmcgc3R1ZGVudElkID0gY29va2llUmVxOwogICAgICAgICAgICAgICAgaW50LlBhcnNlKHN0dWRlbnRJZCk7CgogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQp9
compilation info
prog.cs(1,19): error CS0234: The type or namespace name `Models' does not exist in the namespace `StudentList'. Are you missing an assembly reference?
prog.cs(7,18): error CS0234: The type or namespace name `Mvc' does not exist in the namespace `System.Web'. Are you missing an assembly reference?
prog.cs(12,35): error CS0246: The type or namespace name `Controller' could not be found. Are you missing an assembly reference?
prog.cs(14,17): error CS0246: The type or namespace name `Models' could not be found. Are you missing an assembly reference?
prog.cs(16,16): error CS0246: The type or namespace name `ActionResult' could not be found. Are you missing an assembly reference?
prog.cs(23,16): error CS0246: The type or namespace name `ActionResult' could not be found. Are you missing an assembly reference?
prog.cs(30,16): error CS0246: The type or namespace name `ActionResult' could not be found. Are you missing an assembly reference?
Compilation failed: 7 error(s), 0 warnings
stdout