Ejemplo n.º 1
0
        public HttpResponseMessage Delete(int id)
        {
            var glossary = _glossaryRepository.Get(id);

            if (glossary == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound, new BaseApiResponse
                {
                    Code = InternalApiStatusCode.Error,
                    Message = "Glossary item is not found"
                }));
            }

            try
            {
                _glossaryRepository.Remove(id);

                return(Request.CreateResponse(HttpStatusCode.OK, new BaseApiResponse
                {
                    Code = InternalApiStatusCode.Success,
                    Message = "Glossary item removed"
                }));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex));
            }
        }
        public async Task DeleteAsync(int id)
        {
            GlossaryItem itemForRemoval = await GetItemIfExistsAsync(id);

            _glossaryRepository.Remove(itemForRemoval);
            _unitOfWork.Commit();
        }
Ejemplo n.º 3
0
 public void Delete(string term)
 {
     _repository.Remove(term);
 }