public RedirectResult RequestToBecomeATeacher(WrittenLetterModel _model) { _logger.LogInformation("RequestToBecomeATeacher(post) action"); servicesManager.WrittenLetter.SaveWrittenLetterModelIntoDb(_model); return(Redirect("/")); }
public void SaveWrittenLetterModelIntoDb(WrittenLetterModel _model) { WrittenLetter letter = new WrittenLetter() { UserId = _model.User.Id, Reason = _model.Reason, Experience = _model.Experience }; dataManager.WrittenLetters.SaveWrittenLetterIntoDb(letter); }
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)); }
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); }