コード例 #1
0
        public async Task <ActionResult> Delete(Guid id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                var result = await _service.Delete(id);

                if (result == false)
                {
                    return(BadRequest("Time não encontrado"));
                }
                else
                {
                    return(Ok("Excluído com sucesso"));
                }
            }
            catch (ArgumentException e)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message));
            }
        }
コード例 #2
0
ファイル: TimeCotroller.cs プロジェクト: ptrD3V/CPMS
        public async Task <ActionResult> Delete(int id)
        {
            try
            {
                await _service.Delete(id);

                return(Ok());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            return(BadRequest());
        }
コード例 #3
0
        public async Task <bool> Delete(Guid id)
        {
            try
            {
                var result = await _timeService.Delete(id);

                await _timeService.Commit();

                return(result);
            }
            catch (Exception)
            {
                _timeService.Dispose();
                throw;
            }
        }