public DeliveryOption GetDeliveryOption(Guid OrderGuid) { var deliveryOptionData = (from user in bringlyEntities.tblUsers join odr in bringlyEntities.tblOrders on user.UserGuid equals odr.FK_CreatedByGuid where user.IsDeleted == false && user.IsActive == true && odr.OrderGuid == OrderGuid select new DeliveryOption { UserGuid = user.UserGuid, UserFullName = user.FullName, EmailAddress = user.EmailAddress, MobileNumber = user.MobileNumber, OrderGuid = OrderGuid, BillingAddress = user.tblUserAddresses.Where(z => z.IsDeleted == false && z.AddressType.Equals("Billing", StringComparison.OrdinalIgnoreCase)).Select(z => new UserAddress { Address = z.Address, AddressType = z.AddressType, CountryGuid = z.CountryGuid, CityGuid = z.FK_CityGuid, CityName = z.tblCity.CityName, Country = z.Country, Latitude = z.Latitude, Longitude = z.Longitude, PlaceId = z.PlaceId, PostCode = z.PostCode, UserGuid = z.FK_UserGuid }).FirstOrDefault(), ShippingAddress = user.tblUserAddresses.Where(z => z.IsDeleted == false && z.AddressType.Equals("Shipping", StringComparison.OrdinalIgnoreCase)).Select(z => new UserAddress { Address = z.Address, AddressType = z.AddressType, CountryGuid = z.CountryGuid, CityGuid = z.FK_CityGuid, CityName = z.tblCity.CityName, Country = z.Country, Latitude = z.Latitude, Longitude = z.Longitude, PlaceId = z.PlaceId, PostCode = z.PostCode, UserGuid = z.FK_UserGuid }).FirstOrDefault(), DeliveryType = (OrderType)odr.OrderType }).FirstOrDefault(); CommonDomainLogic commonDomainLogic = new CommonDomainLogic(); deliveryOptionData.CityList = commonDomainLogic.GetCities(); deliveryOptionData.CountryList = commonDomainLogic.GetCountryList(); return(deliveryOptionData); }
/// <summary> /// /// </summary> /// <param name="businessGuid"></param> /// <returns></returns> public BusinessObject GetRestaurantByRestaurantGuid(Guid businessGuid) { BusinessObject business = new BusinessObject(); CommonDomainLogic commonDomainLogic = new CommonDomainLogic(); List <City> list = commonDomainLogic.GetCities(); business = bringlyEntities.tblBusinesses.Where(x => x.BusinessGuid == businessGuid).Select(r => new BusinessObject { BusinessImage = r.BusinessImage , BusinessGuid = r.BusinessGuid , BusinessName = r.BusinessName , CityGuid = r.CityGuid , BusinessTypeGuid = r.FK_BusinessTypeGuid , PNumber = r.PNumber , Phone = r.Phone , PinCode = r.PinCode , CreatedByGuid = r.FK_CreatedByGuid , ManagerGuid = r.ManagerUserGuid , Address = r.Address , Email = r.Email , OrderTiming = r.OrderTiming , PickUpTiming = r.PickUpTiming , ServiceCharge = r.ServiceCharge , ServiceTax = r.ServiceTax , FlatRate = r.FlatRate , RateAfterKm = r.RateAfterKm , Description = r.Description }).FirstOrDefault(); business.CityList = list; business.CityName = business.CityGuid != Guid.Empty ? bringlyEntities.tblCities.Where(x => x.CityGuid == business.CityGuid).FirstOrDefault().CityName : ""; return(business); }