예제 #1
0
        public ActionResult GradeProject(LevelProjectResult result, int? courseId)
        {
            ViewBag.CourseId = courseId.HasValue ? courseId.Value : 0;
            if (result != null)
            {
                if (TryUpdateModel(result))
                {
                    LevelService.UpdateLevelProjectResult(result);
                }

                ViewBag.SuccessMessage = "Verkefni hefur verið uppfært";
                return View(result);
            }
            ViewBag.ErrorMessage = "Gat ekki uppfært kennslugagn! Lagfærðu villur og reyndur aftur.";
            return View();
        }
예제 #2
0
        /// <summary>
        /// Updates a instance of levelproject
        /// </summary>
        /// <param name="levelProjectResult"></param>
        public void UpdateLevelProjectResult(LevelProjectResult levelProjectResult)
        {
            if (levelProjectResult != null)
            {
                var levelProjectResultToUpdate = GetlevelProjectResultsByLevelProjectResultId(levelProjectResult.LevelProjectResultId);
                
                levelProjectResultToUpdate.Grade = levelProjectResult.Grade;
                levelProjectResultToUpdate.TeacherFeedback = levelProjectResult.TeacherFeedback;
                levelProjectResultToUpdate.GradeDate = DateTime.Now;

                var levelProject = GetLevelProject(levelProjectResult.LevelProjectId);
                int points = 25;

                ExternalNotificationContainer.CreateNotification(string.Format("Þú hefur fengið {0} fyrir verkefnið \"{1}\"",
                    levelProjectResult.Grade, levelProject.Name), string.Format("/Project/Index/{0}", levelProject.Level.CourseId), levelProjectResult.UserInfoId);

                ExternalPointContainer.AddPointsToLevel(levelProjectResult.UserInfoId, levelProject.LevelId, points,
                                                        string.Format("Þú hefur fengið {0} stig fyrir verkefnið \"{1}\".",
                                                                      points, levelProject.Name));

                Save();
            }
        }
예제 #3
0
 /// <summary>
 /// checks if level
 /// </summary>
 /// <param name="levelProjectResult"></param>
 public void CreateLevelProjectResult(LevelProjectResult levelProjectResult)
 {
     if (levelProjectResult != null)
     {
         GameSchoolEntities.LevelProjectResults.AddObject(levelProjectResult);
         Save();
     }
 }
예제 #4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="levelProjectResult"></param>
 /// <param name="user"></param>
 public void CreateUserLevelProjectResult(LevelProjectResult levelProjectResult, UserInfo user)
 {
     if (levelProjectResult != null && user != null)
     {
         user.LevelProjectResults.Add(levelProjectResult);
         Save();
     }
 }
예제 #5
0
 private LevelProjectResult CreateLevelProjectResult(LevelProject levelProject, int id, Guid contentId, string filename)
 {
     var result = new LevelProjectResult
                      {
                          CreateDateTime = DateTime.Now,
                          LevelProjectId = levelProject.LevelProjectId,
                          UserInfoId = id,
                          UserFeedback = levelProject.UserFeedback,
                          ContentID = contentId,
                          Filename = filename,
                          GradeDate = DateTime.Now // fæ annars datetime exception
                      };
     return result;
 }