Пример #1
0
        public void DeleteCity(int Id)
        {
            var City = _PPPDB.City.FirstOrDefault(Cx => Cx.Id == Id);

            if (City.Id == Id)
            {
                _PPPDB.Remove(City);
                _PPPDB.SaveChanges();

                // log in behavior for adding in new City Admin
                _logger.LogInformation(2002, "Added new City: {0} to database", Id);
            }
            else
            {
                Console.WriteLine($"City with id {Id} doesn't exist");

                // log in behavior for adding in new City Admin
                _logger.LogWarning(2101, "Added new City Admin {0} to database", Id);
                return;
            }
        }
Пример #2
0
        public void DeleteCityAdmin(int Id)
        {
            var CA = _PPPDB.CityAdmin.FirstOrDefault(ca => ca.Id == Id);

            if (CA.Id == Id)
            {
                _PPPDB.Remove(CA);
                _PPPDB.SaveChanges();

                // log in behavior for adding in new City Admin
                _logger.LogInformation(1002, "Deleted City Admin ID:{0} from database\n", Id);
            }
            else
            {
                Console.WriteLine($"City Admin with id {Id} doesn't exist");

                // log in behavior for adding in new City Admin
                _logger.LogWarning(1101, "Unable to delete City Admin from database: {0} Doesn't Exist\n", Id);
                return;
            }
        }
        public void DeleteIssue(int Id)
        {
            var IX = _PPPDB.Issue.FirstOrDefault(ix => ix.Id == Id);

            if (IX.Id == Id)
            {
                _PPPDB.Remove(IX);
                _PPPDB.SaveChanges();

                // log in behavior for adding in new City Admin
                _logger.LogInformation(3002, "Deleted Issue {0} to database", Id);
            }
            else
            {
                Console.WriteLine($"Issue with id {Id} doesn't exist");

                // log in behavior for adding in new City Admin
                _logger.LogWarning(3201, "Issue {0} doesn't exists in the database", Id);

                return;
            }
        }