public DrawingDTO SaveDrawing(string drawingId, DrawingDTO drawingToSave) { int lotteryId= DrawingManager.Save(drawingId.ToInt(), this DTOItemToSave(drawingToSave)); LotteryDrawing updatedItem = DrawingManager.GetItem(drawingId.ToInt()); return this.DrawingItemToDTO(updatedItem); }
private DrawingDTO DrawingItemToDTO(LotteryDrawing drawingDTO) { DrawingDTO tempItem = new DrawingDTO(); if (drawingDTO !=null) { tempItem.LotteryDrawingId = LotteryDrawing.LotteryDrawingId; if (!string.IsNullOrEmpty(LotteryDrawing.PrizeAmount)) tempItem.PrizeAmount = LotteryDrawing.PrizeAmount; if (!string.IsNullOrEmpty(LotteryDrawing.DrawingDate.ToDate())) tempItem.DrawingDate = LotteryDrawing.DrawingDate.ToDate(); } return tempItem; }
private DrawingDTOCollection DrawingCollectionToDTO(LotteryDrawingCollection drawingCollection) { DrawingDTOCollection tempList = new DrawingDTOCollection(); DrawingDTO tempItem; if(drawingCollection !=null) { foreach (LotteryDrawing item in drawingCollection) { tempItem = new DrawingDTO(); tempItem.LotteryDrawingId = item.LotteryDrawingId; tempList.Add(tempItem); } } return tempList; }