Beispiel #1
0
        public void PatchHug(Hug model)
        {
            var newHug = _hugs.Find(x => x.Id == model.Id);

            if (newHug != null)
            {
                int index = _hugs.IndexOf(newHug);

                if (newHug.From != null)
                {
                    _hugs[index].From = model.From;
                }
                if (newHug.To != null)
                {
                    _hugs[index].To = model.To;
                }
                if (newHug.Reason != null)
                {
                    _hugs[index].Reason = model.Reason;
                }
                if (newHug.Created != null)
                {
                    _hugs[index].Created = model.Created;
                }
            }
        }
Beispiel #2
0
        public void PutHug(Hug model)
        {
            var newHug = _hugs.Find(x => x.Id == model.Id);

            if (newHug != null)
            {
                int index = _hugs.IndexOf(newHug);
                _hugs[index] = model;
            }
        }
Beispiel #3
0
        public bool DeleteById(int id)
        {
            Hug hugToDelete = _hugs.Find(h => h.Id == id);

            if (hugToDelete != null)
            {
                _hugs.Remove(hugToDelete);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #4
0
 public void AddNewModel(Hug model)
 {
     _hugs.Add(model);
 }