Ejemplo n.º 1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            // DotNetBay startup
            var mainRepository = new EFMainRepository();

            mainRepository.SaveChanges();

            AuctionRunner = new AuctionRunner(mainRepository);
            AuctionRunner.Start();
        }
Ejemplo n.º 2
0
        public IHttpActionResult Create(long id)
        {
            Auction auction = repository.GetAuctions().FirstOrDefault(a => a.Id == id);

            if (auction == null)
            {
                return(BadRequest($"No auction with id {id} found"));
            }

            var image = Request.Content.ReadAsByteArrayAsync().Result;

            auction.Image = image;
            //repository.Add(auction);
            repository.SaveChanges();
            return(Ok());
        }
Ejemplo n.º 3
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            // DotNetBay startup
            var mainRepository = new EFMainRepository();

            mainRepository.SaveChanges();

            // SignalR Configuration
            var serializerSettings = new JsonSerializerSettings();

            serializerSettings.ReferenceLoopHandling      = ReferenceLoopHandling.Serialize;
            serializerSettings.PreserveReferencesHandling = PreserveReferencesHandling.Objects;

            var serializer = JsonSerializer.Create(serializerSettings);

            GlobalHost.DependencyResolver.Register(typeof(JsonSerializer), () => serializer);

            AuctionRunner = new AuctionRunner(mainRepository);

            AuctionRunner.Auctioneer.BidAccepted += (sender, args) =>
            #pragma warning disable SA1501 // Statement must not be on a single line
            { AuctionsHub.NotifyBidAccepted(args.Auction, args.Bid); };

            AuctionRunner.Auctioneer.BidDeclined += (sender, args) =>
            { AuctionsHub.NotifyBidDeclined(args.Auction, args.Bid); };

            AuctionRunner.Auctioneer.AuctionStarted += (sender, args) =>
            { AuctionsHub.NotifyAuctionStarted(args.Auction); };

            AuctionRunner.Auctioneer.AuctionEnded += (sender, args) =>
            { AuctionsHub.NotifyAuctionEnded(args.Auction); };

            #pragma warning restore SA1501 // Statement must not be on a single line
            AuctionRunner.Start();
        }