public async Task <IActionResult> Overview() { //await WriteOutIdentityAndAccessInformation(); //await WriteOutAccessInformation(); var queryResult = await _workoutViewModelRepository.GetCollection(new WorkoutOfmCollectionResourceParameters()); if (queryResult.HttpStatusCode == HttpStatusCode.Unauthorized || queryResult.HttpStatusCode == HttpStatusCode.Forbidden) { return(RedirectToAction("AccessDenied", "Authorization")); } List <WorkoutViewModel> listWorkoutViewModel = null; if (queryResult.HttpStatusCode == HttpStatusCode.OK) { listWorkoutViewModel = queryResult.ViewModelForGetCollection.ToList(); return(View("Overview", listWorkoutViewModel)); } var test = queryResult.ErrorMessagesPresented.FirstOrDefault(f => f.Key.ToLower().Contains("exception")).Value.ToString(); return(new ContentResult() { //ContentType = "application/json", ContentType = "text/html;charset=utf-8", //Content = JsonConvert.SerializeObject(queryResult.ErrorMessagesPresented.ToDictionary(item => item.Key.ToString(), item => Regex.Unescape(item.Value.ToString()))) Content = queryResult.ErrorMessagesPresented.FirstOrDefault(f => f.Key.ToLower().Contains("exception")).Value.ToString() }); }
public async Task <IActionResult> Overview() { var categoryViewModelCollectionResult = await _categoryViewModelRepository.GetCollection(new CategoryOfmCollectionResourceParameters()); if (categoryViewModelCollectionResult.HttpStatusCode == HttpStatusCode.Unauthorized || categoryViewModelCollectionResult.HttpStatusCode == HttpStatusCode.Forbidden) { return(RedirectToAction("AccessDenied", "Authorization")); } //if ((int)categoryViewModelCollectionResult.HttpStatusCode != 200) //{ // // Todo: Do something when posting failed //} return(View("Overview", categoryViewModelCollectionResult.ViewModelForGetCollection.ToList())); }
public async Task <IActionResult> Histories(int workoutId) { var workoutHistoryViewModelsCollectionQueryResult = await _workoutHistoryViewModelRepository.GetCollection(new WorkoutHistoryOfmCollectionResourceParameters() { WorkoutId = workoutId }); if (workoutHistoryViewModelsCollectionQueryResult.HttpStatusCode == HttpStatusCode.Unauthorized || workoutHistoryViewModelsCollectionQueryResult.HttpStatusCode == HttpStatusCode.Forbidden) { return(RedirectToAction("AccessDenied", "Authorization")); } IEnumerable <WorkoutHistoryViewModel> workoutHistoryViewModels = null; if ((int)workoutHistoryViewModelsCollectionQueryResult.HttpStatusCode == 200) { workoutHistoryViewModels = workoutHistoryViewModelsCollectionQueryResult.ViewModelForGetCollection; } return(View(workoutHistoryViewModels?.ToList())); }