Exemplo n.º 1
0
        public AllBikesPagerModel BikeInfo(int PageNo, int PageSize)
        {
            var allBikesPagerModel = new AllBikesPagerModel();
            var bikeDetails        = new List <BikeHomeModel>();
            var bikeInformation    = _iBikeHomeDetails.BikeHomeInfo(PageNo, PageSize);
            var pager = _iBikeHomeDetails.BikeListPager(PageNo, PageSize);

            if (bikeInformation != null && bikeInformation.Count() > 0)
            {
                foreach (var item in bikeInformation)
                {
                    var tempBikeDetails = new BikeHomeModel()
                    {
                        BikeId   = item.BikeId,
                        BikeName = item.BikeBrand,
                        ImageUrl = item.ImageDetails.Count() == 0 ? (baseUrl + @"/UploadImage/tempImage.jpg") : item.ImageDetails.FirstOrDefault().ImgPath,
                        //ImageUrl = @"UploadImage/b1.jpg",
                        Driven    = item.BikeKmDriven,
                        ModelYear = Convert.ToString(item.BikeModel),
                        Price     = (decimal)item.BikePrice,
                        IsActive  = (bool)item.IsActive
                    };
                    bikeDetails.Add(tempBikeDetails);
                }
            }
            allBikesPagerModel.BikeHomeModel = bikeDetails;
            allBikesPagerModel.Pager         = pager;
            return(allBikesPagerModel);
        }
Exemplo n.º 2
0
        public List <BikeHomeModel> GetBikInfoCart(List <BikecartlistIds> Bikeids)
        {
            var bikeInformation = new List <BikeHomeModel>();

            if (Bikeids != null)
            {
                using (var db = new ObickeEntities())
                {
                    for (int i = 0; i < Bikeids.Count; i++)
                    {
                        var _Bikeobj   = new BikeHomeModel();
                        int id         = Bikeids[i].BikeId;
                        var Bikedetail = db.BikeInformations.Where(x => x.BikeId == id).FirstOrDefault();
                        if (Bikedetail != null)
                        {
                            _Bikeobj.BikeId    = id;
                            _Bikeobj.Price     = Bikedetail.BikePrice ?? 0;
                            _Bikeobj.BikeName  = Bikedetail.BikeBrand;
                            _Bikeobj.Driven    = Bikedetail.BikeKmDriven;
                            _Bikeobj.ModelYear = Convert.ToString(Bikedetail.BikeRegistrationYear);
                            _Bikeobj.IsActive  = Bikedetail.IsActive;
                            _Bikeobj.ImageUrl  = Bikedetail.ImageDetails.Where(x => x.BikeId == id).Select(k => k.ImgPath).FirstOrDefault() == null ? "" : Bikedetail.ImageDetails.Where(x => x.BikeId == id).Select(k => k.ImgPath).FirstOrDefault();
                        }
                        bikeInformation.Add(_Bikeobj);
                    }
                }
            }
            return(bikeInformation);
        }
Exemplo n.º 3
0
        public List <BikeHomeModel> GetBikeDetailsByIds(List <BikeInfoByIds> bikeInfoById)
        {
            var bikeDetails     = new List <BikeHomeModel>();
            var bikeInformation = _iBikeDetails.BikeInfoByIds(bikeInfoById);

            if (bikeInformation != null && bikeInformation.Count() > 0)
            {
                foreach (var item in bikeInformation)
                {
                    var tempBikeDetails = new BikeHomeModel()
                    {
                        BikeId    = item.BikeId,
                        BikeName  = item.BikeBrand,
                        ImageUrl  = item.ImageDetails.Count() == 0 ? (baseUrl + @"/UploadImage/tempImage.jpg") : (baseUrl + item.ImageDetails.FirstOrDefault().ImgPath.Remove(0, 1)),
                        Driven    = item.BikeKmDriven,
                        ModelYear = Convert.ToString(item.BikeModel),
                        Price     = (decimal)item.BikePrice,
                        IsActive  = (bool)item.IsActive
                    };
                    bikeDetails.Add(tempBikeDetails);
                }
            }
            return(bikeDetails);
        }