public GetTesSetResponse GetTestSet(GetTestSetRequest request) { var response = new GetTesSetResponse { ResponseStatus = ResponseStatus.Success }; if (request.TestSetId < 0) { throw new ApplicationException("Not a valid module"); } try { var testSet = ModuleService.GetTestSet(request.TestSetId); var responseModel = testSet.MapObject <TestSetCreateViewModel>(); responseModel.CreatorId = testSet.Creator.UserId; response.TestSetCreateViewModel = responseModel; } catch (ApplicationException ax) { response.ResponseStatus = ResponseStatus.Warning; response.Message = ax.Message; } catch (Exception ex) { response.ResponseStatus = ResponseStatus.Failur; response.Message = "Unable to retrive module"; } return(response); }
public ActionResult AddModule(int?id) { var viewModel = new TestSetCreateViewModel(); if (id != null) { var request = new GetTestSetRequest() { TestSetId = id.Value }; viewModel = ModuleApiController.GetTestSet(request).TestSetCreateViewModel; viewModel.ViewName = "Edit Module"; } return(View(viewModel)); }