コード例 #1
0
        public RedirectResult RequestToBecomeATeacher(WrittenLetterModel _model)
        {
            _logger.LogInformation("RequestToBecomeATeacher(post) action");

            servicesManager.WrittenLetter.SaveWrittenLetterModelIntoDb(_model);
            return(Redirect("/"));
        }
コード例 #2
0
        public void SaveWrittenLetterModelIntoDb(WrittenLetterModel _model)
        {
            WrittenLetter letter = new WrittenLetter()
            {
                UserId = _model.User.Id, Reason = _model.Reason, Experience = _model.Experience
            };

            dataManager.WrittenLetters.SaveWrittenLetterIntoDb(letter);
        }
コード例 #3
0
        public IActionResult UserInfo(string userId, string exp, string reason)
        {
            _logger.LogInformation("UserInfo action");

            var _user = dataManager.Users.GetUserById(userId);
            WrittenLetterModel _model = new WrittenLetterModel()
            {
                User = _user, Experience = exp, Reason = reason
            };

            return(View(_model));
        }
コード例 #4
0
        public void SaveWrittenLetterModelIntoDbUnit()
        {
            var managerMock = new DataManagerMock(new AnswersRepositoryMock(), new QuestionsRepositoryMock(),
                                                  new TestsRepositoryMock(), new StatisticRepositoryMock(), new UsersRepositoryMock(),
                                                  new WrittenLetterRepositoryMock());

            var writtenLetterService = new WrittenLetterService(managerMock);

            WrittenLetterModel writtenLetterModel = new WrittenLetterModel()
            {
                User = new ApplicationUser()
                {
                    Id = "1"
                }, Reason = "reason1", Experience = "experience1"
            };

            writtenLetterService.SaveWrittenLetterModelIntoDb(writtenLetterModel);

            Assert.Equal(true, WrittenLetterRepositoryMock.SavedToDb);
        }