public async Task <Notification> Add(Notification notification) { var bandit = await dbContext .Set <Entities.Bandit>() .FindAsync(notification.Bandit.Id); var dbNotif = new Entities.Notification { Bandit = bandit, Title = notification.Title, Body = notification.Body }; await dbContext .Set <Entities.Notification>() .AddAsync(dbNotif); await dbContext.SaveChangesAsync(); return(notification); }
public bool Put(Entities.Notification n) { _unitOfWorkAsync.Repository <Entities.Notification>().Update(n); return(_unitOfWorkAsync.SaveChanges() > 0); }
public void CreateNotification(Entities.Notification notification) { notification.ID = notifications.Count() + 1; notification.DateTime = DateTime.Now; notifications.Add(notification); }
public long Post(Entities.Notification n) { _unitOfWorkAsync.Repository <Entities.Notification>().Insert(n); _unitOfWorkAsync.SaveChanges(); return(n.NotificationID); }