public SharedListComment CreateSharedListComment(SharedListComment model) { var entryEntity = _context.Comments.Add(model); _context.SaveChanges(); return(entryEntity.Entity); }
public bool DeleteSharedListComment(SharedListComment model) { var entity = _context.Comments.FirstOrDefault(c => c.Id == model.Id); if (entity != null) { _context.Comments.Remove(entity); _context.SaveChanges(); return(true); } return(false); }
public bool UpdateSharedListComment(SharedListComment model) { var updatingEntity = _context.Comments.FirstOrDefault(c => c.Id == model.Id); if (updatingEntity != null) { updatingEntity.Update(model); _context.Entry(updatingEntity).State = EntityState.Modified; _context.SaveChanges(); return(true); } return(false); }