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; } } }
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; } }
public bool DeleteById(int id) { Hug hugToDelete = _hugs.Find(h => h.Id == id); if (hugToDelete != null) { _hugs.Remove(hugToDelete); return(true); } else { return(false); } }
public void AddNewModel(Hug model) { _hugs.Add(model); }