public HttpResponseMessage Update(Facade.SubscriptionPut subscriptionPut) { return(ProcessPut(() => { var current = entityById.Get <Subscription>(subscriptionPut.Id.ToModel()); current.Callback = subscriptionPut.Callback.ToModel(); updateCommand.Execute(current); })); }
public HttpResponseMessage History(Identity topicId, Identity feedId) { var workingFeed = entityById.Get <Feed>(feedId); var syndicationFeed = CreateSyndicationFromFeed(topicId, workingFeed); return(new HttpResponseMessage <SyndicationFeed>(syndicationFeed, HttpStatusCode.OK) { Content = { Headers = { ContentType = new MediaTypeHeaderValue("application/atom+xml") } } }); }
public ActionResult Edit(string id) { var identity = new Identity(id); var entity = entityById.Get <Topic>(identity); if (entity == null) { return(new HttpStatusCodeResult(404)); } var model = new EditTopicModel(entity, groupsSortedByName.Execute()); return(View(model)); }
public ActionResult Edit(string id) { var groupId = new Identity(id); var group = entityById.Get <Group>(groupId); if (group == null) { return(View("GroupDoesNotExist")); } var model = new GroupEditModel { Group = new GroupModel { Id = group.Id.ToString(), Name = group.Name, Description = group.Description, ParentId = group.ParentId.ToString() }, GroupList = GetGroupList(groupId) }; return(View(model)); }
private void ValidateCircleReferences(Group group) { var parentsId = new HashSet <Identity>(); var currentParentId = group.ParentId; while (currentParentId.HasValue) { if (!parentsId.Add(currentParentId.Value)) { break; } currentParentId = entityById.Get <Group>(currentParentId.Value).ParentId; } if (parentsId.Contains(group.Id.Value)) { throw new ValidationException(string.Format(Texts.GroupCircleReference, group.Id)); } }
public IEnumerable <MessageKey> Get(Identity subscriptionId, Identity?last = null, int?skip = null, int?limit = null) { var subscription = entityById.Get <Subscription>(subscriptionId); if (subscription != null) { switch (subscription.TargetKind) { case TargetKind.Topic: return(messageByTopic.Get(subscription.TargetId.Value, last, skip, limit)); case TargetKind.Group: return(messageByGroup.Get(subscription.TargetId.Value, last, skip, limit)); default: throw new InvalidOperationException(string.Format(Texts.TargetKindUnknown, subscription.TargetKind)); } } return(new MessageKey[0]); }
public HttpResponseMessage <Facade.Group> Get(Identity id) { return(ProcessGet(() => entityById.Get <Group>(id).ToFacade())); }
public HttpResponseMessage <Topic> Get(Identity id) { return(ProcessGet(() => entityById.Get <M.Topic>(id.ToModel()).ToFacade())); }