Exemple #1
0
 public void updateTopic(Topic topic)
 {
     Topic oldTopic = _topicRepository.Find(topic.ID);
     oldTopic.TopicName = topic.TopicName;
     oldTopic.Status = topic.Status;
     _topicRepository.InsertOrUpdate(oldTopic);
     _unitOfWork.Save();
 }
        public void InsertOrUpdate(Topic topic)
        {
            if (topic.ID == default(int)) // New entity
            {
            topic.Form = new Form();
            topic.Form.FormName = topic.TopicName;
            _context.SetAdd(topic);

            }
            else        // Existing entity
            {
            topic.Form.FormName = topic.TopicName;
            _context.SetModified(topic);
            _context.SetModified(topic.Form);

            }
        }
Exemple #3
0
 public void AddNewTopic(Topic topic)
 {
     _topicRepository.InsertOrUpdate(topic);
     _unitOfWork.Save();
 }
Exemple #4
0
 public TopicViewModel(Topic topic)
 {
     this.ID = topic.ID;
     this.TopicName = topic.TopicName;
 }