예제 #1
0
 public IActionResult Delete(int id)
 {
     try
     {
         _rep.Delete(id);
         _rep.UnitOfWork.SaveChanges();
         return(Ok(ApiResponse.Ok(id)));
     }
     catch (Exception e)
     {
         return(BadRequest(ApiResponse.Error(id, e.Message)));
     }
 }
예제 #2
0
        public IActionResult Delete(int authorId)
        {
            var authorToDelete = _authorsRepository.GetById(authorId);

            if (authorToDelete == null)
            {
                return(NotFound());
            }

            _authorsRepository.Delete(authorId);

            return(new NoContentResult());
        }
예제 #3
0
 public async Task DeleteAndSave(string Id)
 {
     _authorRepo.Delete(Id);
     await _authorRepo.Save();
 }
예제 #4
0
 // DELETE: api/Authors/5
 public void Delete(int id)
 {
     authorsRepository.Delete(id);
 }
예제 #5
0
        public void Delete(string id)
        {
            var author = GetAuthorById(id);

            authorsRepository.Delete(author);
        }
예제 #6
0
 public int Delete(int id)
 {
     return(_authorsRepository.Delete(id));
 }
        public async Task <IActionResult> Delete(string id)
        {
            await authorsRepository.Delete(id);

            return(Ok("Author deleted"));
        }
예제 #8
0
        // DELETE: api/authors/5
        public HttpResponseMessage Delete(int id)
        {
            bool deleted = _authorsRepository.Delete(id);

            return(Request.CreateResponse <bool>(HttpStatusCode.OK, deleted));
        }