public IActionResult Delete(string id) { var apartment = _apartmentsService.Get(id); if (apartment == null) { return(NotFound()); } _apartmentsService.Remove(apartment.objectId); return(NoContent()); }
public ActionResult DeleteConfirmed(string Id) { try { var apartments = _apartmentsService.Get(Id); if (apartments == null) { return(NotFound()); } _apartmentsService.Remove(apartments.objectId); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }