Exemple #1
0
        /// <summary>
        /// Convert entity to dto
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public static StockElementDTO ConvertToDto(StockElement entity)
        {
            var dto = new StockElementDTO()
            {
                Name           = entity.Name,
                PurchaseDate   = entity.PurchaseDate,
                ExpirationDate = entity.ExpirationDate,
                OpeningDate    = entity.OpeningDate,
                ConservationPeriodAfterOpening = entity.ConservationPeriodAfterOpening,
            };

            return(dto);
        }
Exemple #2
0
        public static StockElement UpdateEntity(StockElement stockElement, OpeningStockElementDTO updateDto)
        {
            if (updateDto.ConservationPeriodAfterOpening != null)
            {
                stockElement.ConservationPeriodAfterOpening = updateDto.ConservationPeriodAfterOpening;
            }

            if (updateDto.OpeningDate != null)
            {
                stockElement.OpeningDate = updateDto.OpeningDate;
            }

            return(stockElement);
        }