Ejemplo n.º 1
0
        public ActionResult AddFinalEvaluation(int id, CreateFinalEvaluationViewModel model)
        {
            var thesis = this.Data.Theses.GetById(id);
            var userId = this.User.Identity.GetUserId();

            if (this.IsThesisTeacher(userId, thesis) && thesis.FinalEvaluation == null)
            {
                if (ModelState.IsValid)
                {
                    thesis.FinishedAt = DateTime.Now;
                    thesis.FinalEvaluation = model.FinalEvaluation;
                    this.Data.SaveChanges();

                    var logger = this.loggerCreator.Create(this.Data);
                    var log =new ThesisLog
                    {
                        ThesisId = id,
                        UserId = userId,
                        LogType = LogType.AddedFinalEvaluation,
                        ForwardUrl = string.Format(GlobalPatternConstants.FORWARD_URL_WITH_ID, "Thesis", "ThesisProfile", id)
                    };
                    logger.Log(log);

                    CreateNotification(id, userId, log.ForwardUrl, GlobalPatternConstants.NOTIFICATION_ADDED_FINAL_EVALUATION);

                    return RedirectToAction("ThesisProfile", "Thesis", new { id = id });
                }

                return View(model);
            }

            return RedirectToAction("Index", "Storage");
        }
Ejemplo n.º 2
0
        public ActionResult AddFinalEvaluation(int id, CreateFinalEvaluationViewModel model)
        {
            var thesis = this.Data.Theses.GetById(id);
            var userId = this.User.Identity.GetUserId();

            if (this.IsThesisTeacher(userId, thesis) && thesis.FinalEvaluation == null)
            {
                if (ModelState.IsValid)
                {
                    thesis.FinishedAt      = DateTime.Now;
                    thesis.FinalEvaluation = model.FinalEvaluation;
                    this.Data.SaveChanges();

                    var logger = this.loggerCreator.Create(this.Data);
                    var log    = new ThesisLog
                    {
                        ThesisId   = id,
                        UserId     = userId,
                        LogType    = LogType.AddedFinalEvaluation,
                        ForwardUrl = string.Format(GlobalPatternConstants.FORWARD_URL_WITH_ID, "Thesis", "ThesisProfile", id)
                    };
                    logger.Log(log);

                    CreateNotification(id, userId, log.ForwardUrl, GlobalPatternConstants.NOTIFICATION_ADDED_FINAL_EVALUATION);

                    return(RedirectToAction("ThesisProfile", "Thesis", new { id = id }));
                }

                return(View(model));
            }

            return(RedirectToAction("Index", "Storage"));
        }
Ejemplo n.º 3
0
        public ActionResult AddFinalEvaluation(int id)
        {
            var thesis = this.Data.Theses.GetById(id);
            var userId = this.User.Identity.GetUserId();

            if (this.IsThesisTeacher(userId, thesis) && thesis.FinalEvaluation == null)
            {
                var finalEvaluation = new CreateFinalEvaluationViewModel { Id = id };
                return View(finalEvaluation);
            }

            return RedirectToAction("Index", "Storage");
        }
Ejemplo n.º 4
0
        public ActionResult AddFinalEvaluation(int id)
        {
            var thesis = this.Data.Theses.GetById(id);
            var userId = this.User.Identity.GetUserId();

            if (this.IsThesisTeacher(userId, thesis) && thesis.FinalEvaluation == null)
            {
                var finalEvaluation = new CreateFinalEvaluationViewModel {
                    Id = id
                };
                return(View(finalEvaluation));
            }

            return(RedirectToAction("Index", "Storage"));
        }