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(); }
/// <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(); } }
/// <summary> /// checks if level /// </summary> /// <param name="levelProjectResult"></param> public void CreateLevelProjectResult(LevelProjectResult levelProjectResult) { if (levelProjectResult != null) { GameSchoolEntities.LevelProjectResults.AddObject(levelProjectResult); Save(); } }
/// <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(); } }
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; }