public void AddEditWarehouse(WarehouseDTO warehouse, string username, int id = 0) { if (id == 0) { // ADD Warehouse newWarehouse = new Warehouse { Name = warehouse.Name, AdminId = _warehouseRepo.FindUserByUsername(username).Id, }; _warehouseRepo.Add(newWarehouse); _warehouseRepo.SaveChanges(); } else { // EDIT } }