public IActionResult PutNotification([FromRoute] int id, [FromBody] NotificationDTO notification) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != notification.Id) { return(BadRequest()); } var databaseNotification = _notificationService.GetTaggedNotification(id); databaseNotification.UpdateWith(notification); _tagService.AssignTags <NotificationDTO, Notification, NotificationTags>(notification, databaseNotification); _dbContext.SaveChanges(); return(NoContent()); }
// POST: /<controller>/ public IActionResult PutSubscriptor(int id, [FromBody] SubscriptionDTO model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != model.Id) { return(BadRequest()); } var databaseSubscription = _deviceService.GetTaggedSubscription(id); databaseSubscription.Update(model); _tagService.AssignTags <SubscriptionDTO, Subscription, SubscriptionTags>(model, databaseSubscription); _context.SaveChanges(); return(NoContent()); }