public IActionResult Delete(int id) { var hasSchedule = _sheduleService.GetRoomSchedules(id).ToList(); if (hasSchedule.Count() == 0) { _sheduleService.DeleteRoom(id); var data = GetItems(null); return(PartialView("ItemsTable", data)); } else { return(BadRequest("There are room appointments!")); } }