public void DeleteZone(Guid id) { var Zone = new Zone(); if (id != null) { Zone = _ZoneRepositorý.GetById(id); if (Zone != null) { _ZoneRepositorý.Delete(Zone); } } }
public IActionResult Delete(int id) { if ((new[] { "Admin" }).Contains(ValidateTokenAndRole.ValidateAndGetRole(Request), StringComparer.OrdinalIgnoreCase)) { if (repo.GetOne(id) == null) { return(NotFound()); } else { repo.Delete(id); return(Ok()); } } else { return(Unauthorized()); } }