public ActionResult UpdateTestTitle(TestTitleDto testTitleDto) { if (testTitleDto != null) { try { var testTitleFromDb = testsService.GetTestTitle(testTitleDto.Id); if (testTitleFromDb != null) { var convertedTestTitle = testTitleDto.GetTestTitle(testTitleFromDb, testTitleDto); testsService.UpdateTestTitle(convertedTestTitle); } else { throw new Exception("The test title does not exist"); } } catch (Exception e) { Program.Logger.Error(e); return(Ok(GetResponse(ResponseType.FAIL, ResponseStatusCode.FAIL, GetError(ErrorCodes.dataNotFound, "Failed", "Error occurred while updating the test title")))); } return(Ok(GetResponse(ResponseType.ACK, ResponseStatusCode.SUCCESS))); } else { return(BadRequest(GetResponse(ResponseType.ERROR, ResponseStatusCode.ERROR, GetError(ErrorCodes.invalidData, "Invalid input", "Please enter proper test title details")))); } }
public ActionResult AddNewTestTitle(TestTitleDto testTitleDto) { if (testTitleDto != null) { var testTitle = testTitleDto.GetTestTile(testTitleDto); if (testTitle != null) { try { testsService.InsertTestTitle(testTitle); } catch (Exception e) { Program.Logger.Error(e); return(Ok(GetResponse(ResponseType.FAIL, ResponseStatusCode.FAIL, GetError(ErrorCodes.dataNotFound, "Failed", "Error occurred while creating new test title")))); } return(Ok(GetResponse(ResponseType.ACK, ResponseStatusCode.SUCCESS))); } else { return(Ok(GetResponse(ResponseType.FAIL, ResponseStatusCode.FAIL, GetError(ErrorCodes.dataNotFound, "Failed", "Something went wrong.")))); } } else { return(BadRequest(GetResponse(ResponseType.ERROR, ResponseStatusCode.ERROR, GetError(ErrorCodes.invalidData, "Invalid input", "Please enter proper test title details")))); } }
public async Task <TestTitleDto> DeleteTestTitle(TestTitleDto responseModel) { var url = URLBuilder.GetURL(Controllers.TEST, EndPoint.TEST_TITLE_DELETE); return(await requestProvider.DeleteAsync(url, responseModel, new Dictionary <string, string> { ["id"] = responseModel.Id.ToString() })); }
protected async override void GetModelItems() { SearchTitle = string.Empty; IsBusy = Visibility.Visible; var response = await testService.GetOtherTestResults(); IsBusy = Visibility.Collapsed; if (response != null) { if (response.OtherTests != null) { ModelDtos = SortOtherTests(response.OtherTests); TestGroupTypeDtos = response.Groups; TestTitleTypeDtos = response.Titles; if (cachedModel != null) { SelectedModel = ModelDtos?.FirstOrDefault(x => x.TestTitleId == cachedModel.Id); if (SelectedModel == null) { if (ModelDtos.Count > 0) { SelectedModel = ModelDtos.First(); } } cachedModel = null; } else { if (ModelDtos.Count > 0) { SelectedModel = ModelDtos.First(); } } } } }
public async Task <TestTitleDto> AddNewTestTitle(TestTitleDto testTitleDto) { var url = URLBuilder.GetURL(Controllers.TEST, EndPoint.TEST_TITLE_ADD); return(await requestProvider.PostAsync(url, testTitleDto)); }
public async Task <TestTitleDto> UpdateTestTitle(TestTitleDto testTitleDto) { var url = URLBuilder.GetURL(Controllers.TEST, EndPoint.TEST_TITLE_UPDATE); return(await requestProvider.PutAsync(url, testTitleDto)); }
public void OnTestTitleSelected(TestTitleDto model) { cachedModel = model; }