public AquariumType LookupFromName(AquariumType type) { if (type != null && type.Id == 0 && type.Name != null) { AquariumTypes lookupType = (AquariumTypes)Enum.Parse(typeof(AquariumTypes), type.Name); type = new AquariumType { Id = (int)lookupType, Name = lookupType.ToString() }; } return(type); }
public Aquarium(AquariumType aquariumType) : base() { _aquariumType = aquariumType; switch (aquariumType) { case AquariumType.Freshwater: _volume = 2.00; this.Capacity = 5; break; case AquariumType.SeaWater: _volume = 2.00; this.Capacity = 5; break; } }
public Aquarium(AquariumType aquariumType, double volume, byte capacity) : base() { try { if (volume <= 0 || capacity == 0) { throw new ArgumentException("Недопустимые значения объема и/или емкости!!!"); } _aquariumType = aquariumType; _volume = volume; this.Capacity = capacity; } catch (ArgumentException) { throw; } }