public ActionResult GetProfileStatistic(string userLogin)
        {
            var userService = new UsersManagementService();

            var subjectService = new SubjectManagementService();

            var user = userService.GetUser(userLogin);

            var labs = 0;
            var lects = 0;

            if (user.Lecturer == null)
            {
                labs = subjectService.LabsCountByStudent(user.Id);
            }
            else
            {
                labs = subjectService.LabsCountByLector(user.Id);
            }

            return Json(new
            {
                Labs = labs,
                Lects = lects
            });
        }
        public UserInfoViewModel(int _id)
        {
            var context = new LmPlatformModelsContext();
            var id = context.ProjectUsers.Find(_id).UserId;

            if (context.Students.Find(id) != null)
            {
                //var creator = context.Students.Find(id);
                var creator = new Student();
                foreach (var student in context.Students)
                {
                    if (student.Id == id)
                    {
                        creator = student;
                    }
                }

                UserName = creator.LastName + " " + creator.FirstName + " " + creator.MiddleName;
                GroupNumber = context.Groups.Find(creator.GroupId).Name;
                ProjectQuentity = context.ProjectUsers.Select(e => e.User).Count(e => e.Id == creator.Id);
                Role = "Студент";
            }
            else
            {
                var creator = context.Lecturers.Find(id);
                UserName = creator.LastName + " " + creator.FirstName + " " + creator.MiddleName;
                ProjectQuentity = context.ProjectUsers.Select(e => e.User).Count(e => e.Id == creator.Id);
                Role = "Преподаватель";

                var _context = new SubjectManagementService();
                SubjectList = new List<Subject>();
                foreach (var subject in _context.GetUserSubjects(creator.Id))
                {
                    SubjectList.Add(subject);
                }
            }
        }
        public ActionResult GetProfileInfoCalendar(string userLogin)
		{
			var userService = new UsersManagementService();

            var subjectService = new SubjectManagementService();
           
            var user = userService.GetUser(userLogin);
            
            var labsEvents =
		        subjectService.GetLabEvents(user.Id)
		            .Select(e => new ProfileCalendarViewModel() { color = e.Color, title = e.Title, start = e.Start })
		            .ToList();

            var lectEvents =
                subjectService.GetLecturesEvents(user.Id)
                    .Select(e => new ProfileCalendarViewModel() { color = e.Color, title = e.Title, start = e.Start })
                    .ToList();

			return Json(new
			                {
			                    Labs = labsEvents,
                                Lect = lectEvents
			                });
		}
        public ActionResult GetProfileInfoSubjects(string userLogin)
        {
            var userService = new UsersManagementService();

            var subjectService = new SubjectManagementService();

            var user = userService.GetUser(userLogin);

            List<Subject> model;

            if (user.Lecturer == null)
            {
                model = subjectService.GetSubjectsByStudent(user.Id);
            }
            else
            {
                model = subjectService.GetSubjectsByLector(user.Id);
            }


			var returnModel = new List<object>();

	        foreach (var subject in model)
	        {
		        returnModel.Add(new
                                              {
                                                  Name = subject.Name,
                                                  Id = subject.Id,
                                                  ShortName = subject.ShortName,
												  Completing = subjectService.GetSubjectCompleting(subject.Id)
                                              });
	        }

            return Json(returnModel);
        }