public async Task Insert(NotifyAdd notifyAdd) { try { var notification = new Notification() { Id = Guid.NewGuid().ToString(), User = notifyAdd.UserName, DateTime = notifyAdd.DateTime, NotificationType = notifyAdd.NotificationType, Hyperlink = notifyAdd.Hyperlink, Message = notifyAdd.Message, ProfileId = notifyAdd.ProfileId, Parameters = JsonConvert.SerializeObject(notifyAdd.Parameters), RawMessage = JsonConvert.SerializeObject(notifyAdd), Read = false, Status = 1 }; await _context.Notifications.AddAsync(notification); await _context.SaveChangesAsync(); } catch (Exception e) { throw new ApplicationException(e.Message); } }
private ResponseMessage BuildResponseMessage(NotifyAdd notifyAdd) { return(new ResponseMessage() { Code = 200, Data = new Dictionary <string, object>() { { "Message", JsonConvert.SerializeObject(notifyAdd) } }, Errors = null }); }