public ActionResult predict(int Aid)
        {
            var x = _IAuctionService.getAuctionById(Aid);

            int direction1 = 5;

            if (!String.IsNullOrEmpty(x.Direction1))
            {
                direction1 = _IAuctionService.getAllDirections().Where(y => y.name == x.Direction1).SingleOrDefault().Id;
            }
            int direction2 = 5;

            if (!String.IsNullOrEmpty(x.Direction2))
            {
                direction2 = _IAuctionService.getAllDirections().Where(y => y.name == x.Direction2).SingleOrDefault().Id;
            }
            int direction3 = 5;

            if (!String.IsNullOrEmpty(x.Direction3))
            {
                direction3 = _IAuctionService.getAllDirections().Where(y => y.name == x.Direction3).SingleOrDefault().Id;
            }
            int direction4 = 5;

            if (!String.IsNullOrEmpty(x.Direction4))
            {
                direction4 = _IAuctionService.getAllDirections().Where(y => y.name == x.Direction4).SingleOrDefault().Id;
            }
            int location   = decodeLocation(x.LocationId);
            int floor      = decodeFloor(x.floorId);
            int decoration = decodeDecoration(x.DecorationId);
            int hView      = decodeView(x.hviewId);

            int direction = decodeDirection(direction1, direction2, direction3, direction4);
            int size      = x.size;

            //////////////////////
            auctionWebService1.auctionWebService1 aws = new auctionWebService1.auctionWebService1();
            int startBid = Convert.ToInt32(aws.calc(location, floor, decoration, hView, direction) * size) * 1000;

            //int startBid = Convert.ToInt32(aws.calc(2, 2, 2, 2, 2));
            ///////////////////
            ViewBag.sb = startBid;
            ViewBag.id = Aid;
            return(View());
        }
        public ActionResult addAuction(AddAuctionDto dto, IEnumerable <HttpPostedFileBase> files)
        {
            int      hID   = _IAuctionService.addHouse(dto);
            ImageDto Imdto = new ImageDto();

            foreach (var file in files)
            {
                if (file.ContentLength > (4 * 1024 * 1024))
                {
                    ModelState.AddModelError("CustomError", "file size must be less than 4MB");
                    return(View());
                }
                if (!(file.ContentType == "image/jpeg" || file.ContentType == "image/png" || file.ContentType == "image/gif"))
                {
                    ModelState.AddModelError("CustomError", "الأنماط المسموحة :jpeg , png , gif");
                    return(View());
                }
                Imdto.source = new byte[file.ContentLength];
                file.InputStream.Read(Imdto.source, 0, file.ContentLength);
                Imdto.HouseId = hID;
                _IAuctionService.addImage(Imdto);
                Imdto = new ImageDto();
            }
            dto.OwnerId = getGuid(User.Identity.GetUserId());
            // string s1 = _IAuctionService.getAllDecorations().Where(x => x.Id == dto.decorationId).Single().type;

            dto.startBid   = 0;
            dto.HouseId    = hID;
            dto.startBid   = 0;
            dto.CurrentBid = 0;

            int direction1 = 5;

            if (!String.IsNullOrEmpty(dto.Direction1))
            {
                direction1 = _IAuctionService.getAllDirections().Where(y => y.name == dto.Direction1).SingleOrDefault().Id;
            }
            int direction2 = 5;

            if (!String.IsNullOrEmpty(dto.Direction2))
            {
                direction2 = _IAuctionService.getAllDirections().Where(y => y.name == dto.Direction2).SingleOrDefault().Id;
            }
            int direction3 = 5;

            if (!String.IsNullOrEmpty(dto.Direction3))
            {
                direction3 = _IAuctionService.getAllDirections().Where(y => y.name == dto.Direction3).SingleOrDefault().Id;
            }
            int direction4 = 5;

            if (!String.IsNullOrEmpty(dto.Direction4))
            {
                direction4 = _IAuctionService.getAllDirections().Where(y => y.name == dto.Direction4).SingleOrDefault().Id;
            }

            int location   = decodeLocation(dto.locationId);
            int floor      = decodeFloor(dto.floorId);
            int decoration = decodeDecoration(dto.decorationId);
            int hView      = decodeView(dto.h_ViewId);

            int direction = decodeDirection(direction1, direction2, direction3, direction4);
            int size      = dto.size;

            //////////////////////
            auctionWebService1.auctionWebService1 aws = new auctionWebService1.auctionWebService1();
            int startBid = Convert.ToInt32(aws.calc(location, floor, decoration, hView, direction) * size) * 1000;

            dto.startBid = dto.CurrentBid = startBid;
            var u = _IAuctionService.addAuction(dto);

            return(RedirectToAction("predict", new { Aid = u }));
        }