public Unit(DataAccess.Entities.Unit unit) { this.Id = unit.Id; this.Sequence = unit.Sequence; this.Description = unit.Description; this.CourseId = unit.CourseId; this.CourseName = unit.Course.Description; this.Topics = new List <Topic>(); }
public IActionResult Post(Unit unit) { var unitEntity = new DataAccess.Entities.Unit() { Description = unit.Description, Sequence = unit.Sequence, CourseId = unit.CourseId }; this.unitOfWork.Units.Add(unitEntity); this.unitOfWork.Complete(); if (unitEntity.Course == null) { unitEntity.Course = this.unitOfWork.Courses.Get(unitEntity.CourseId); } return(Ok(new Unit(unitEntity))); }