Esempio n. 1
0
        protected override void Initialize(HttpControllerContext controllerContext)
        {
            base.Initialize(controllerContext);
            EShopeMobileServiceContext context = new EShopeMobileServiceContext();

            DomainManager = new EntityDomainManager <Order>(context, Request);
        }
        protected override void Initialize(HttpControllerContext controllerContext)
        {
            base.Initialize(controllerContext);
            EShopeMobileServiceContext context = new EShopeMobileServiceContext();

            DomainManager = new EntityDomainManager <Product>(context, Request);
            //DomainManager = new DefaultMappedEntityDomainManager<ProductDTO, Product>(context, Request/*, Services*/);
        }
 async Task <Order> GetOrderFromDB(string orderId)
 {
     return(await ExceptionHelper.TryCatch <Order>(async() =>
     {
         using (var context = new EShopeMobileServiceContext())
         {
             var order = context.Orders.Include(o => o.User)
                         .Include(o => o.OrderItems).Include(o => o.OrderItems.Select(i => i.Product))
                         .FirstOrDefaultAsync(o => o.Id == orderId);
             return await order;
         }
     }));
 }
Esempio n. 4
0
        protected override void Seed(EShopeMobileServiceContext context)
        {
            EShopeSeedData.AddToContext(context);
            base.Seed(context);
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //
        }