Example #1
0
        public async Task <IActionResult> DeleteApartment(int id)
        {
            var host = await _hostService.LoggedHost();

            if (host != null)
            {
                _apartmentService.DeleteApartment(id);
                return(Ok());
            }
            return(BadRequest());
        }
Example #2
0
        public async Task <IActionResult> DeleteApartment(int id)
        {
            if (id == 0)
            {
                return(BadRequest());
            }

            var apartmentToBeDeleted = await _apartmentService.GetApartmentsById(id);

            if (apartmentToBeDeleted == null)
            {
                return(NotFound());
            }

            await _apartmentService.DeleteApartment(apartmentToBeDeleted);

            return(NoContent());
        }