Exemple #1
0
        public void GetTopic_ExistentTopic_ShouldReturnSpecificTopicFromDB()
        {
            topicRepositoryInMemory.Add(oneTopic);
            topicRepositoryInMemory.Add(anotherTopic);
            topicRepositoryInMemory.SaveChanges();

            Assert.AreEqual(topicRepositoryInMemory.Get(oneTopic.Id),
                            oneTopic);
        }
Exemple #2
0
 public TopicDetailModel Save(TopicDetailModel model)
 {
     if (model.Id == Guid.Empty)
     {
         return(repository.Add(model));
     }
     else
     {
         repository.Update(model);
         return(model);
     }
 }
        public IActionResult Create(FileUpload fileObj)
        {
            Topic oTopic = JsonConvert.DeserializeObject <Topic>(fileObj.Entity);

            if (fileObj.File.Length > 0)
            {
                using (var memoryStream = new MemoryStream())
                {
                    fileObj.File.CopyTo(memoryStream);
                    var fileBytes = memoryStream.ToArray();
                    oTopic.Image = fileBytes;

                    _topicRepository.Add(oTopic);

                    return(View());
                }
            }

            return(View());
        }
Exemple #4
0
 public void TestFindTopicByName()
 {
     topicRepository.Add(topic);
     Assert.AreEqual("Test", topicRepository.FindTopicByName("Test").Description);
     topicRepository.Delete(topic);
 }
Exemple #5
0
 public List <TopicVM> Add(Topic item)
 {
     tr.Add(item);
     return(ListTopics());
 }