public void AdaugaGradina(Models.Gradina.Gradina gradina) { try { var result = gradini.FirstOrDefault(d => d.Equals(gradina)); if (result != null) { throw new LocationAlreadyTakenException("Gradina exista deja la locatia" + gradina.nrLocatie); } gradini.Add(gradina); Console.WriteLine("O noua gradina a fost plantata la locatia " + gradina.nrLocatie); } catch (LocationAlreadyTakenException e) { Console.WriteLine(e.Message); } }
public Gradina CreeazaGradina(int nrLocatie) { try { if (nrLocatie < 1 || nrLocatie > 10) { throw new ArgumentInvalidException("Dati un nr intre 1 si 10"); } var gradina = new Gradina(nrLocatie); return(gradina); } catch (ArgumentInvalidException e) { Console.WriteLine(e.Message); } return(null); }
public void AfiseazaFlori(Models.Gradina.Gradina gradina) { Console.WriteLine(gradina.Flori.ToString()); }
public void AfiseazaLegume(Models.Gradina.Gradina gradina) { Console.WriteLine(gradina.Legume.ToString()); }
public void StergeGradina(Models.Gradina.Gradina gradina) { Console.WriteLine("Gradina a fost deplantata."); }