public void AddLike(Likes like) { var ctx = new QuestionsDbContext(_connectionString); ctx.Likes.Add(like); ctx.SaveChanges(); }
public void UpdateLikes(int id, User user) { using var context = new QADbContext(_connectionString); var like = new Likes { QuestionId = id, UserId = user.Id }; context.Likes.Add(like); context.SaveChanges(); }