public ActionResult SolutionEdit(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.SolutionEdit(model); return(RedirectToAction("TaskList", new { CourseId = cs.GetTask(model.TaskId).CourseId })); }