public IActionResult Delete(int id) { var propertyOwnerId = _propertyService.GetById(id).UserId; var clientId = _userManager.GetUserId(User); if (propertyOwnerId != clientId) { return(Unauthorized()); } if (_propertyService.DeleteById(id)) { return(RedirectToAction("Listing", "Hosting")); } return(BadRequest()); }