Ejemplo n.º 1
0
        public IActionResult Delete(int id)
        {
            IActionResult _result       = new ObjectResult(false);
            GenericResult _removeResult = null;

            try
            {
                Problem _problemToRemove = this._problemRepository.GetSingle(id);
                _problemRepository.Delete(_problemToRemove);
                _problemRepository.Commit();

                _removeResult = new GenericResult()
                {
                    Succeeded = true,
                    Message   = "Problem removed."
                };
            }
            catch (Exception ex)
            {
                _removeResult = new GenericResult()
                {
                    Succeeded = false,
                    Message   = ex.Message
                };

                _loggingRepository.Add(new Error()
                {
                    Message = ex.Message, StackTrace = ex.StackTrace, DateCreated = DateTime.Now
                });
                _loggingRepository.Commit();
            }

            _result = new ObjectResult(_removeResult);
            return(_result);
        }