Esempio n. 1
0
        public ActionResult Edit(string partitionKey, string rowKey)
        {
            var feed = new Feed();

            if (!string.IsNullOrEmpty(partitionKey) && !string.IsNullOrEmpty(rowKey))
            {
                feed = _feedRepository.GetByPartitionKeyAndRowKey(partitionKey, rowKey);
            }
            var feedViewModel = new FeedViewModel
            {
                Feed = feed,
                GroupFeeds = _groupFeedRepository.GetByPartitionKey(_userId)
            };

            return View(feedViewModel);
        }
Esempio n. 2
0
        public ActionResult Edit(Feed feed)
        {
            if (string.IsNullOrEmpty(feed.RowKey))
            {
                feed.RowKey = Guid.NewGuid().ToString();
            }

            var feedData = new Feed
            {
                PartitionKey = _userId,
                RowKey = feed.RowKey,
                Title = feed.Title,
                Description = feed.Description,
                Timestamp = new DateTimeOffset(DateTime.Now),
                FeedGroup = feed.FeedGroup,
                Url = feed.Url
            };

            _feedRepository.InsertOrReplace(feedData);
            _azureQueue.AddMessage(new CloudQueueMessage(string.Format("{{'partitionKey':'{0}','rowKey':'{1}'}}", feedData.PartitionKey, feedData.RowKey)));
            return RedirectToAction("Index");
        }