public ActionResult InsertSolution(SolutionModel model, HttpPostedFileBase upload) { CourseServices cs = new CourseServices(); UserServices us = new UserServices(); HttpCookie loggedStudent = Request.Cookies["LoggedUser"]; model.Student = us.GetStudent(loggedStudent.Values.Get("Login")); model.StudentId = model.Student.IdUcznia; model.FileName = upload.FileName; using (var reader = new System.IO.BinaryReader(upload.InputStream)) { model.Solution = reader.ReadBytes(upload.ContentLength); } cs.NewSolution(model); return(RedirectToAction("ManageCourses", "Student")); }