Exemplo n.º 1
0
        public IActionResult DeleteLine(int LineId)
        {
            //null Dto not exists
            if (!_LineRepository.LineExists(LineId))
            {
                return(NotFound());
            }


            //retrieve and delete the network
            var newLine = _LineRepository.GetLine(LineId);

            //check if record was delete successfully or not

            if (!_LineRepository.DeleteLine(newLine))
            {
                ModelState.AddModelError("", $"Something is wrong with the deletion of the record{newLine.Id}");
                return(StatusCode(500, ModelState));
            }

            return(StatusCode(200, "success at deletion"));
        }