Example #1
0
        public async Task <ServiceResponse <List <User> > > DeleteUser(Guid id)
        {
            User userToDelete = await _context.Users.Where(x => x.ID == id).FirstOrDefaultAsync();

            _context.Remove(userToDelete);
            await _context.SaveChangesAsync();

            ServiceResponse <List <User> > userResponse = new ServiceResponse <List <User> >
            {
                Data = await _context.Users.ToListAsync()
            };

            return(userResponse);
        }
        public async Task <ServiceResponse <List <Property> > > DeleteProperty(Guid propertyID)
        {
            Property propertyToDelete = await _context.Property.Where(x => x.ID == propertyID).FirstOrDefaultAsync();

            _context.Remove(propertyToDelete);
            await _context.SaveChangesAsync();

            ServiceResponse <List <Property> > propertyResponse = new ServiceResponse <List <Property> >
            {
                Data = await _context.Property.ToListAsync()
            };

            return(propertyResponse);
        }