Example #1
0
        public async Task <IActionResult> Delete(int id)
        {
            /*
             * ---------------------------------------------------------------------------
             * ZONA DE VALIDACION
             * ---------------------------------------------------------------------------
             */
            // Chequear si el cover existe
            var cover = await _coverTypeRepository.GetCoverType(id);

            if (cover == null)
            {
                throw new Exception($"Cover with id {id} does not exist");
            }

            /*
             * --------------------------------------------------------------------------
             * ZONA DE PROCESAMIENTO DE LA PETICION
             * --------------------------------------------------------------------------
             */
            _coverTypeRepository.Delete <CoverType>(cover);
            await _coverTypeRepository.SaveAll();

            return(NoContent());
        }