Ejemplo n.º 1
0
        public async Task NewBill(InputBillDto inputBillDto, string destiny)
        {
            try
            {
                var paymentMethod = SystemConstants.ListPaymentMethods().FirstOrDefault(wh => wh.SysId == inputBillDto.PaymentMethodSysId);
                var billDestiny   = destiny.ToUpper() == SystemConstants.BillDestinyReceive
                    ? SystemConstants.BillDestinyReceive
                    : SystemConstants.BillDestinyPay;

                var bill = new Bill(
                    paymentMethod,
                    inputBillDto.Value,
                    billDestiny,
                    SystemConstants.BillStatus_EmAberto,
                    inputBillDto.DueDate,
                    inputBillDto.Description
                    );

                await _ravenDatabaseProvider.CreateEntity <Bill>(bill);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> NewReceivable([FromBody] InputBillDto inputBillDto)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                await _billProvider.NewBill(inputBillDto, SystemConstants.BillDestinyReceive);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }