Ejemplo n.º 1
0
        /// <summary>
        ///     Deletes all workout data associated with a given user in the workout setting.
        /// </summary>
        /// <returns> View with message describing if workouts were removed successfully or not. </returns>
        public async Task <IActionResult> DeleteAllWorkoutData()
        {
            var user = await GetCurrentUserAsync();

            var isDeleted = await _workoutService.DeleteAllWorkoutAsync(user.Id);

            var message = ManageMessageId.DeleteAllWorkoutDataError;

            if (isDeleted)
            {
                message = ManageMessageId.DeleteAllWorkoutDataSuccess;
            }

            return(RedirectToAction(nameof(Index), new { Message = message })); // Try again
        }