public async Task <bool> SetLike(QuoteLike qlike) { using (AppDBContext _context = new AppDBContext()) { QuoteLike remoteQlike = new QuoteLike(qlike); remoteQlike.RemoteUser = await GetBy(new { field = "InformationID", value = qlike.InformationNotificationFK.ToString() }); await Update(qlike.UpdateQuote); _context.Notifications.Add(Notification.Create(qlike.RemoteInfoNotificationFK, "qlike", JsonConvert.SerializeObject(remoteQlike), DateTime.Now)); _context.QuoteLikes.Add(qlike); await _context.SaveChangesAsync(); return(true); } }
public JsonResult SetLike([FromBody] QuoteLike qlike) { return(new JsonResult(Quotes.SetLike(qlike))); }