public PartialViewResult SubscribeForACourse(int?courseId)
        {
            _courseService.AddSubscriber(courseId);
            var userId = User.Identity.GetUserId();

            _journalService.Create(userId, courseId);

            var courseDto = _courseService.GetCourse(courseId);

            ViewBag.Teacher = UserManager.FindById(courseDto.TutorId).UserName;
            var resultModel = Convert(courseDto);

            resultModel.Subscribed = true;
            return(PartialView("_SubscribeButton", resultModel));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create(
            [FromBody] string title,
            [FromServices] ICurrentUserService service)
        {
            if (ModelState.IsValid)
            {
                var user = await service.GetCurrentUser(HttpContext);

                var result = await _service.Create(title, user.Id);

                return(Ok(result));
            }

            return(BadRequest(ModelState));
        }
Esempio n. 3
0
 // journal
 public static XmlDocument CreateJournalEntry(IJournalService service, string testUserId, string journalEntry)
 {
     return service.Create(testUserId, journalEntry);
 }