public virtual async Task UpdateHtmlEventMarkup(HtmlEventMarkupModelDto model) { var entity = await _notificationsContext.HtmlEventMarkups.FindAsync(model.Id); if (entity == null) { throw new NotFoundException(typeof(HtmlEventMarkup).Name, model.Id.ToString()); } entity.Name = model.Name; entity.Subject = model.Subject; entity.Subtitle = model.Subtitle; entity.ChangesMarkup = model.ChangesMarkup; _notificationsContext.Update(entity); await _notificationsContext.SaveChangesAsync(); }
public virtual async Task UpdateEvent(EventDto eventModel) { if (eventModel.Id == Guid.Empty) { throw new IdNullOrEmptyException(); } var target = await _notificationsContext.Events.FindAsync(eventModel.Id); if (target == null) { throw new NotFoundException(typeof(Event).Name, eventModel.Id.ToString()); } target.EventName = eventModel.EventName; target.NotificationTypes = JsonConvert.SerializeObject(eventModel.NotificationTypes); target.PropagationTypes = JsonConvert.SerializeObject(eventModel.PropagationTypes); _notificationsContext.Update(target); await _notificationsContext.SaveChangesAsync(); }