public Observe Add(Observe observe) { if (context.Observed.Where(x => x.UserId == observe.UserId && x.UserObserverdId == observe.UserObserverdId).FirstOrDefault() == null) { context.Observed.Add(observe); context.SaveChanges(); } return(observe); }
public Observe Remove(string observeUserId) { Observe observe = context.Observed.Find(observeUserId); if (observe != null) { context.Observed.Remove(observe); context.SaveChanges(); } return(observe); }