/// <summary> /// Конвертация в статистику БД /// </summary> /// <param name="statistics">Статистика</param> /// <returns>Статистика БД</returns> public static StatisticsEnt Convert(Statistics statistics) { if (statistics != null) { var x = Unit.StatisticsRepository.GetItem(statistics.Id); if (x != null) { return(x); } else { StatisticsEnt ent = new StatisticsEnt { AverageCostOfGoods = statistics.AverageCostOfGoods, AverageSellingPrice = statistics.AverageSellingPrice, Date = statistics.Date, Id = statistics.Id, NumberOfGoodsSold = statistics.NumberOfGoodsSold, QuantityOfGoodsInStock = statistics.QuantityOfGoodsInStock }; return(ent); } } else { return(null); } }
/// <summary> /// Конвертация в статистику /// </summary> /// <param name="statistics">Статистика БД</param> /// <returns>Статистика </returns> public static Statistics Convert(StatisticsEnt statistics) { if (statistics != null) { Statistics ent = new Statistics { AverageCostOfGoods = statistics.AverageCostOfGoods, AverageSellingPrice = statistics.AverageSellingPrice, Date = statistics.Date, Id = statistics.Id, NumberOfGoodsSold = statistics.NumberOfGoodsSold, QuantityOfGoodsInStock = statistics.QuantityOfGoodsInStock }; return(ent); } else { return(null); } }