public async Task <string> UpdateSubScenarioAsync([FromBody] SubScenarioViewModel request, int scenId, int projId) { var response = new ListModelResponse <SubScenarioViewModel>(); var scenariosDataModel = false; try { scenariosDataModel = await _subscenarioRepository.UpdateSubScenario(request.ToEntity(), scenId, projId); if (scenariosDataModel) { // response.Message = String.Format("Record Updated Successfully"); response.Message = Messages.SuccessMsg; } else { // response.Message = String.Format("Record Updation failed"); response.Message = Messages.FailMsg; } } catch (Exception ex) { response.DidError = true; response.ErrorMessage = ex.Message; } return(response.Message); }
public async Task <string> CreateSubScenarioAsync([FromBody] SubScenarioViewModel request) { // HttpRequest res = null; var response = new ListModelResponse <SubScenarioViewModel>(); var scenarioDataModel = false; try { var maxscenId = await _subscenarioRepository.GetMaxSubScenarioId(request.ProjectId.Value, request.Scen_Id.Value); request.SubScenarioId = Convert.ToString(Convert.ToInt32(maxscenId.FirstOrDefault()) + 1); //ends here scenarioDataModel = await _subscenarioRepository.CreateSubScenario(request.ToEntity()); if (scenarioDataModel) { // response.Message = String.Format("Created User Successfully"); response.Message = Messages.CreateSuccessMsg; } else { //response.Message = String.Format("Create User failed"); response.Message = Messages.CreateFailMsg; } } catch (Exception ex) { response.DidError = true; response.ErrorMessage = ex.Message; } return(response.Message); }
public async Task <string> DeleteSubScenAsync([FromBody] SubScenarioViewModel request) { var response = new ListModelResponse <SubScenarioViewModel>(); var subscenariosDataModel = false; try { subscenariosDataModel = await _subscenarioRepository.DeleteSubScenario(request.ToEntity()); if (subscenariosDataModel) { response.Message = Messages.DeletionSuccessMsg; } else { response.Message = Messages.DeletionFailMsg; } } catch (Exception ex) { response.DidError = true; response.ErrorMessage = ex.Message; } return(response.Message); }