public List <CoreBikeInformation> BikeInfoDetails() { var responseList = new List <CoreBikeInformation>(); var bikeDetails = _iBikeDetails.BikeInfo(); if (bikeDetails.Count > 0) { foreach (var item in bikeDetails) { var coreBikeInformation = new CoreBikeInformation() { BikeId = item.BikeId, BikeBrand = item.BikeBrand, BikeModel = Convert.ToString(item.BikeModel), BikeKmDriven = item.BikeKmDriven, BikeDescription = item.BikeDescription, BikePrice = item.BikePrice, BikePreferDateTimeIn = item.BikePreferDateTimeIn, BikePreferDateTimeOut = item.BikePreferDateTimeOut, BikeOwnerName = item.BikeOwnerName, BikeResonForSale = item.BikeResonForSale, BikeEngineNo = item.BikeEngineNo, BikeChasisNo = item.BikeChasisNo, IsActive = item.IsActive, IsDelete = item.IsDelete, CreatedDateTime = item.CreatedDateTime, ModifiedDateTime = item.ModifiedDateTime }; responseList.Add(coreBikeInformation); } } return(responseList); }
public BikeInformation PostBikeInfoDetails(CoreBikeInformation BikeInformationsmodel) { using (var db = new ObickeEntities()) { using (var transaction = db.Database.BeginTransaction()) { try { BikeInformation data = new BikeInformation() { BikeBrand = BikeInformationsmodel.BikeBrand, BikeModel = Convert.ToDecimal(BikeInformationsmodel.BikeModel), BikeRegistrationYear = BikeInformationsmodel.BikeRegistrationYear, BikeKmDriven = BikeInformationsmodel.BikeKmDriven, BikeDescription = BikeInformationsmodel.BikeDescription, BikeOwnerName = BikeInformationsmodel.BikeOwnerName, BikePrice = BikeInformationsmodel.BikePrice, IsActive = true, IsDelete = false }; db.BikeInformations.Add(data); db.SaveChanges(); foreach (var obj in BikeInformationsmodel.Imagepath) { ImageDetail imgdeatails = new ImageDetail() { BikeId = data.BikeId, ImgPath = obj.Imagepath }; db.ImageDetails.Add(imgdeatails); } db.SaveChanges(); transaction.Commit(); return(data); } catch (Exception Ex) { string msg = Ex.ToString(); transaction.Rollback(); return(null); } } } }
public CoreBikeInformation GetBikInfo(int?id) { CoreBikeInformation BikeResult = new CoreBikeInformation(); List <CoreImagedetails> imagedetails = new List <CoreImagedetails>(); using (var db = new ObickeEntities()) { var Bikeinfo = db.stpGetBikedetailsInfo(id).ToList(); if (Bikeinfo != null && Bikeinfo.Count > 0) { var BikeInformation = Bikeinfo.FirstOrDefault(); BikeResult = new CoreBikeInformation() { BikeId = BikeInformation.BikeId, BikeBrand = BikeInformation.BikeBrand, BikeDescription = BikeInformation.BikeDescription, BikeKmDriven = BikeInformation.BikeKmDriven, BikeModel = Convert.ToString(BikeInformation.BikeModel), BikeRegistrationYear = BikeInformation.BikeRegistrationYear, BikePrice = BikeInformation.BikePrice }; foreach (var item in Bikeinfo) { CoreImagedetails imgRes = new CoreImagedetails() { Bikeid = BikeInformation.BikeId, Imagepath = baseUrl + item.ImgPath.Remove(0, 1) }; imagedetails.Add(imgRes); } BikeResult.Imagepath = imagedetails; } } return(BikeResult); }
public BikeInformation PostBikeInfoDetails(CoreBikeInformation BikeInformations) { var result = _iBikeDetails.PostBikeInfoDetails(BikeInformations); return(result); }