コード例 #1
0
        public async Task <IActionResult> Delete(int id)
        {
            var result = await _serviceAluno.Delete(id);

            if (result)
            {
                return(Ok());
            }

            return(BadRequest(new { Succes = false }));
        }
コード例 #2
0
        public ContentResult DeleteAluno(Guid idAluno)
        {
            ContentResult response = new ContentResult {
                ContentType = "application/json"
            };

            try
            {
                var result = _service.Delete(idAluno);
                _uof.Commit();

                response.StatusCode = (int)HttpStatusCode.OK;
                response.Content    = JsonConvert.SerializeObject(result);
                return(response);
            }
            catch (Exception ex)
            {
                response.StatusCode = (int)HttpStatusCode.BadRequest;
                response.Content    = JsonConvert.SerializeObject(ex.Message);
                return(response);
            }
        }