예제 #1
0
        public IActionResult Delete(int id)
        {
            try
            {
                PBOnDemand singleById = _pbOnDemandRepository.GetById(id);

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

                _pbOnDemandRepository.Delete(singleById);
                int save = _pbOnDemandRepository.Save();

                if (save > 0)
                {
                    return(NoContent());
                }

                return(BadRequest());
            }
            catch (Exception exception)
            {
                //Do something with the exception
                return(StatusCode((int)HttpStatusCode.InternalServerError));
            }
        }