Exemple #1
0
        public async Task ValidateRickTravels()
        {
            // Criar o Rick
            var rick = await rickService.Create("W-584");

            //Cria as Dimensões para Viajar

            var qy58 = await rickService.CreateDimension("QY-58");

            var qy589 = await rickService.CreateDimension("QY-589");

            // Registra as Viagens
            await travelService.Create(rick.Id, qy58.Id);

            await travelService.Create(rick.Id, qy589.Id);

            rick = await rickService.GetRick(rick.Id);

            Assert.IsNotNull(rick.Travels);
            Assert.AreEqual(2, rick.Travels.Count);
            Assert.AreEqual("QY-58", rick.Travels[0].Dimension.Name);
            Assert.AreEqual("QY-589", rick.Travels[1].Dimension.Name);
        }
        public async Task <ApplicationResult> Index(int?id)
        {
            if (id != null)
            {
                return(await RickLocationUtil.CallService <Rick>("sucess",
                                                                 String.Format("Erro ao obter o Rick {0} ", id),
                                                                 async() => { return await rickService.GetRick((int)id); }));
            }

            return(await RickLocationUtil.CallService <IEnumerable <Rick> >("sucess",
                                                                            "Erro os Listar os Ricks",
                                                                            async() => { return await rickService.GetAllRicks(); }));
        }