Beispiel #1
0
 public Topic(DataAccess.Entities.Topic topic)
 {
     this.Id          = topic.Id;
     this.Description = topic.Description;
     this.UnitId      = topic.UnitId;
     this.UnitName    = topic.Unit.Description;
 }
Beispiel #2
0
        public IActionResult Post(Topic topic)
        {
            var topicEntity = new DataAccess.Entities.Topic()
            {
                Description = topic.Description,
                UnitId      = topic.UnitId
            };

            this.unitOfWork.Topics.Add(topicEntity);
            this.unitOfWork.Complete();

            if (topicEntity.Unit == null)
            {
                topicEntity.Unit = this.unitOfWork.Units.Get(topicEntity.UnitId);
            }

            return(Ok(new Topic(topicEntity)));
        }