public async Task <IActionResult> AddDesafio(AddDesafioViewModel model) { if (ModelState.IsValid) { try { var profId = _userService.Get_ProfesorId(User.Claims); var res = await _ctrlService .Add_DesafioCurso(profId, model); if (res) { this.SetAlerts("success-alerts", "El desafío se agregó exitosamente"); } else { this.SetAlerts("error-alerts", "No se pudo agregar el desafío"); } } catch (ApplicationServicesException e) { this.SetAlerts("error-alerts", e.Message); } } return(RedirectToAction("Details", "ProfesorCurso", new { idCurso = model.Id })); }
public async Task <IActionResult> AddChallenge(int courseId, int challengeId) => await this.Post(ModelState, async() => { var teacherId = _userService.Get_ProfesorId(User.Claims); return(await _cursoService.Add_DesafioCurso(teacherId, courseId, challengeId)); });