Exemplo n.º 1
0
        public async Task <ReceiptForCreateDto> CreateReceipt(ReceiptForCreateDto receipt)
        {
            var re = new Receipt()
            {
                Image     = receipt.Image,
                Date      = DateTime.Now,
                CreatorId = receipt.CreatorId
            };

            _context.Receipts.Add(re);
            await _context.SaveChangesAsync();

            return(ReceiptTranslator.ToReceiptForCreateDto(re));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> CreateReceipt([FromBody] ReceiptForCreateDto receipt)
        {
            var result = await _receiptService.CreateReceipt(receipt);

            return(new ObjectResult(ApiResponse.Create(result)));
        }