public async Task<ActionResult> EditTopic(string topicId)
 {
     var vm = new EditTopicViewModel();
     vm.TopicId = topicId;
     vm.EditTarget = await DbContext.Topics.FindAsync(topicId);
     return View(vm);
 }
 public async Task<ActionResult> AddTopic()
 {
     var vm = new EditTopicViewModel();
     TopicModel topicModel = TopicModel.GenerateNewTopic();
     vm.TopicId = topicModel.TopicId;
     vm.EditTarget = topicModel;
     return View("EditTopic",vm);
 }
        public async Task<ActionResult> EditTopic(EditTopicViewModel vm)
        {
            vm.EditTarget.TopicId = vm.TopicId;
            TopicModel lastModel = await DbContext.Topics.FindAsync(vm.TopicId);
            if (lastModel != null)
            {
                DbContext.Topics.Remove(lastModel);

                await DbContext.SaveChangesAsync();
            }
            DbContext.Topics.Add(vm.EditTarget);
            await DbContext.SaveChangesAsync();
            var thumbnailManager = new TopicThumbnailManager(new BlobStorageConnection());
            await thumbnailManager.UploadAsync(vm.TopicId, vm.Thumbnail);
            return RedirectToAction("TopicList");
        }