public async Task <IActionResult> DeleteAll() { try { var storage = HttpContext.Session?.GetString("StorageName"); if (storage != null) { return(new BadRequestObjectResult("Вы должны выйти из хранилища")); } var storages = storageContext.Storages .Where(s => s.User == User.Identity.Name); if (storages == null) { return(new BadRequestObjectResult("Список хранилищ пуст")); } dataLite.Close(); dataLite.DeleteAll(); storageContext.RemoveRange(storages); await storageContext.SaveChangesAsync(); } catch (Exception ex) { logger.LogInformation(ex.StackTrace); return(new BadRequestObjectResult(ex.Message)); } return(new OkObjectResult("Все хранилища удалины")); }