Ejemplo n.º 1
0
        public async Task <IActionResult> Index([Bind("Name,About,IsPublished")] Workout workout)
        {
            User user = _userService.GetByEmail(User.Identity.Name);

            var res = await _workoutService.AddWorkout(user, workout);

            return(Ok(res));
        }
        public async Task <IActionResult> CreateWorkout([FromBody] WorkoutCreateRequest request)
        {
            var created = await _workoutService.AddWorkout(request, HttpContext.GetUserId());

            if (!created)
            {
                return(StatusCode(500));
            }

            return(StatusCode(201));
        }