Beispiel #1
0
        internal DetailDto ConvertDetail(Detail detail)
        {
            var detailDto = new DetailDto()
            {
                Cost             = detail.Cost,
                Description      = detail.Description,
                Id               = detail.Id,
                IsPurchased      = detail.IsPurchased,
                RouteName        = detail.Routes.FirstOrDefault() != null?detail.Routes.First().Name : null,
                Title            = detail.Title,
                WorkshopSequence = detail.WorkshopSequence
            };

            return(detailDto);
        }
Beispiel #2
0
        internal DetailDto ConvertDetailForViewing(Detail detail)
        {
            var detailDto = new DetailDto()
            {
                Cost                   = detail.Cost,
                Description            = detail.Description,
                Id                     = detail.Id,
                IsPurchased            = detail.IsPurchased,
                RouteName              = detail.Routes.First() != null?detail.Routes.First().Name : null,
                Title                  = detail.Title,
                WorkshopSequence       = detail.WorkshopSequence,
                EquipmentsIdSequence   = detail.EquipmentsIdSequence,
                EquipmentsNameSequence = detail.EquipmentsNameSequence
            };

            return(detailDto);
        }
Beispiel #3
0
        internal Detail ConvertDetail(DetailDto detailDto)
        {
            var detail = new Detail()
            {
                Cost             = detailDto.Cost,
                Description      = detailDto.Description,
                IsPurchased      = detailDto.IsPurchased,
                WorkshopSequence = detailDto.WorkshopSequence != null ? detailDto.WorkshopSequence : new List <int>(),
                Title            = detailDto.Title
            };

            if (detailDto.Id.HasValue)
            {
                detail.Id = (int)detailDto.Id;
            }

            return(detail);
        }