Exemplo n.º 1
0
        public async Task <ActionResult> Create([FromForm] ArticleCreateViewModel article)
        {
            try
            {
                await _articlesApiProxy.CreateAsync <ArticleCreateViewModel>(article, _tokenAuth.GetToken());

                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception)
            {
                return(View(article));
            }
        }
        // GET: Course/Details/5
        public async Task <ActionResult> Details(int id)
        {
            try
            {
                var course = await _apiProxy.FindWithParticipantsAsync <CourseDetailsViewModel>(id, _tokenAuth.GetToken());

                ViewBag.Title = course.Name;
                return(View(course));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }