Beispiel #1
0
        public void Create(DiaryNote note)
        {
            var list = ReadFromFile();

            list.Add(note);

            WriteToFile(list);
        }
Beispiel #2
0
        public bool Update(DiaryNote note)
        {
            var list         = ReadFromFile();
            var itemToUpdate = list.FirstOrDefault(x => x.Id == note.Id);

            if (itemToUpdate is null)
            {
                return(false);
            }

            itemToUpdate.Id            = note.Id;
            itemToUpdate.Date          = note.Date;
            itemToUpdate.Pressure      = note.Pressure;
            itemToUpdate.Cloudness     = note.Cloudness;
            itemToUpdate.WindDirection = note.WindDirection;
            WriteToFile(list);

            return(true);
        }