示例#1
0
        public async Task <string> DeleteScenAsync([FromBody] ScenarioViewModel request)
        {
            var response = new ListModelResponse <ScenarioViewModel>();

            var scenariosDataModel = false;

            try
            {
                scenariosDataModel = await _scenarioRepository.DeleteScenario(request.ToEntity());

                if (scenariosDataModel)
                {
                    response.Message = Messages.DeletionSuccessMsg;
                }
                else
                {
                    response.Message = Messages.DeletionFailMsg;
                }
            }
            catch (Exception ex)
            {
                response.DidError     = true;
                response.ErrorMessage = ex.Message;
            }

            return(response.Message);
        }
示例#2
0
        public async Task <bool> DeleteScenarioSV(int id)
        {
            try
            {
                bool check = await _scenario.DeleteScenario(id);

                if (check == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (DbUpdateException)
            {
                throw;
            }
        }