Пример #1
0
        public async Task <ActionResult <CakeDto> > GetCake(string sweet)
        {
            if (sweet == null)
            {
                return(NotFound());
            }
            var newcake = await cake.GetCake(sweet);

            return(Ok(mapper.Map <CakeDto>(newcake)));
        }
Пример #2
0
        public async Task <ActionResult <string> > PayCharge(string name, ChargesTemplate charges)
        {
            if (name == null)
            {
                return(NotFound());
            }
            var getcake = await cake.GetCake(name);

            charges.Amount = getcake.Price;
            var newcharge = await InitializeCharge(charges);

            verification = JsonConvert.DeserializeObject <Verification>(newcharge);
            if (verification != null)
            {
                return(Ok(verification.Data.Reference));
            }
            return(BadRequest("Try again"));
        }
Пример #3
0
        public async Task <ActionResult <Reciept> > OrderCake(string name, OrderTemplate model)
        {
            if (name == null)
            {
                return(NotFound("Enter name of cake"));
            }
            var getcake = await cake.GetCake(name);

            model.Amount = getcake.Price;
            var reference = await InitializeTransaction(model);

            var newcontent = await Verify(reference);

            Reciept reciept = JsonConvert.DeserializeObject <Reciept>(newcontent);

            if (reciept != null)
            {
                return(Ok(reciept));
            }
            return(BadRequest("Try again"));
        }