Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            try
            {
                //Application Start
                CelebsService celebsService = new CelebsService();
                CelebsService.ResetData();

                //GetAll
                var celebs = celebsService.GetAll();


                //Reset
                CelebsService.ResetData();

                bool Deleted1 = celebsService.Delete(3);
                var  celebs2  = celebsService.GetAll();

                bool Deleted2 = celebsService.Delete(5);
                var  celebs3  = celebsService.GetAll();



                CelebsService.ResetData();
                var celebs4 = celebsService.GetAll();
            }
            catch (Exception e)
            {
                int i = 5;
            }

            //Console.WriteLine("Hello World!");
        }
        public IActionResult Delete(int id)
        {
            try
            {
                var celebsService = new CelebsService();
                var found         = celebsService.Delete(id);
                var statusCode    = (found) ? StatusCodes.Status200OK : StatusCodes.Status404NotFound;

                return(StatusCode(statusCode));
            }
            catch (Exception e)
            {
                _logger.LogError("{0}", e.ToString());
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }