public ActionResult Add() { VMMakeAdd vmMake = new VMMakeAdd(); Guid teknolojiID = Guid.Parse("35391ff3-c30d-4a6a-b30b-14079eaaa455"); vmMake.Categories = CategoryDAL.GetList(x => x.SubCategoryID == teknolojiID && x.IsActive == true); return(View(vmMake)); }
public IActionResult GetAll() { IList <Category> list = _CategoryDal.GetList(); if (list != null && list.Count > 0) { return(Ok(list)); } else { return(NotFound("Burada hiç kayıt bulunmadı!")); } }
public ActionResult Add() { Property property = new Property(); Guid temp = Guid.Parse("35391ff3-c30d-4a6a-b30b-14079eaaa455"); property.Categories = CategoryDAL.GetList(x => x.SubCategoryID == temp); return(View()); }
public ActionResult Add() { VMProduct p = new VMProduct(); //p.ProductModels = ProductModelDAL.GetList(); Guid teknolojiID = Guid.Parse("35391ff3-c30d-4a6a-b30b-14079eaaa455"); p.Categories = CategoryDAL.GetList(x => x.SubCategoryID == teknolojiID); return(View(p)); }
public DeliveryInfo calculateFor(CartProducts carts) { List <Carts> cartItems = new List <Carts>(); List <Products> productItems = new List <Products>(); List <Categories> categoryItems = new List <Categories>(); List <CartProducts> cartProductItems = new List <CartProducts>(); double costForDelivery = 5.99; //anlaşmalı kargo teslimatı birim fiyatı double fixedCost = 2.99; // sabit fiyat double calculatedDeliveryCost = 0.0; cartProductItems = _cartProductDAL.GetList(); cartItems = _cartDAL.GetList(); productItems = _productDAL.GetList(); categoryItems = _categoryDAL.GetList(); var itemsInCart = //sepetteki ürünler ve kategorileri from CartProduct in cartProductItems join Cart in cartItems on CartProduct.CartId equals Cart.Id join Product in productItems on CartProduct.ProductId equals Product.Id select new { Cart.Id, CartProduct.ProductId, Product.CategoryId, Product.Price }; var thisCartItem = itemsInCart.Where(x => x.Id == carts.CartId).ToList(); // bu sepetteki ürünlerin var numberOfProduct = itemsInCart.Where(x => x.Id == carts.CartId).ToList().Distinct().Select(p => p.ProductId).Count(); // sepette kaç farklı ürün var var numberOfDelivery = itemsInCart.Where(x => x.ProductId == carts.ProductId).ToList().Distinct().Select(c => c.CategoryId).Count(); // sepette kaç farklı ürün kategorisi var for (int i = 0; i < numberOfProduct; i++) { var costPerProduct = itemsInCart.Where(x => x.ProductId == carts.ProductId).ToList().Distinct().Select(p => p.Price).FirstOrDefault(); // sepetteki her bir ürünün birim fiyatı calculatedDeliveryCost = (costForDelivery * numberOfDelivery) + (Convert.ToDouble(costPerProduct) * numberOfProduct) + fixedCost; // teslimat tutarının hesaplanması Deliveries delivery = new Deliveries() { CartId = itemsInCart.Select(c => c.Id).FirstOrDefault(), CostPerDelivery = costForDelivery, CostPerProduct = Convert.ToDouble(costPerProduct), FixedCost = fixedCost }; _deliveryDAL.Add(delivery); // teslimatın eklenmesi } DeliveryInfo deliveryInfo = new DeliveryInfo() { Info = "Kargo Teslimat Tutarı", Price = calculatedDeliveryCost }; return(deliveryInfo); }
public IDataResult <List <Category> > GetList() { //Business codes return(new SuccessDataResult <List <Category> >(_categoryDal.GetList().ToList())); }
public ViewCartItem applyDiscounts(List <Campaigns> campaigns) { List <Carts> cartItems = new List <Carts>(); List <Products> productItems = new List <Products>(); List <Categories> categoryItems = new List <Categories>(); List <CartProducts> cartProductItems = new List <CartProducts>(); ViewCartItem viewCartItem = new ViewCartItem(); cartProductItems = _cartProductDAL.GetList(); cartItems = _cartDAL.GetList(); categoryItems = _categoryDAL.GetList(); productItems = _productDAL.GetList(); // discountTypeItems = _discountType.GetList(); var totalPriceInCart = //sepetteki toplam tutar from CartProduct in cartProductItems join Cart in cartItems on CartProduct.CartId equals Cart.Id join Product in productItems on CartProduct.ProductId equals Product.Id select new { TotalPrice = Cart.TotalPrice, Product.CategoryId, ProductName = Product.Title, UnitPrice = Product.Price, Amount = Cart.Amount }; var totalAmountInCart = //sepetteki toplam adet from CartProduct in cartProductItems join Cart in cartItems on CartProduct.CartId equals Cart.Id join Product in productItems on CartProduct.ProductId equals Product.Id select new { TotalAmount = Cart.Amount, Product.CategoryId, ProductId = Product.Id, ProductName = Product.Title, CartId = Cart.Id, UnitPrice = Product.Price, Amount = Cart.Amount }; // tanımlanacak kampanyalar içinden sepetteki ürünlerde geçerliliğinin kontrolü foreach (var campaignCategory in campaigns) { //kampanyalı kategorinin toplam tutar limiti var totalPricebyCampaignCategory = totalPriceInCart.Where(c => c.CategoryId == campaignCategory.CategoryId).Select(p => p.TotalPrice).ToList().FirstOrDefault(); //kampanyalı kategorinin miktar limiti var totalAmountbyCampaignCategory = totalAmountInCart.Where(c => c.CategoryId == campaignCategory.CategoryId).Select(a => a.TotalAmount).ToList().FirstOrDefault(); //sepette kampanyalı kategori varsa ve kampanya miktar koşulu sağlanıyorsa indirim uygulanacak if (totalAmountbyCampaignCategory >= campaignCategory.AmountLimit) { int isExist = _campaignDAL.GetList().Where(x => x.Id == campaignCategory.CategoryId).Count(); if (isExist < 1) { _campaignDAL.Add(campaignCategory);// kampanya eklendi } var discountedProducts = totalAmountInCart.Where(x => x.CategoryId == campaignCategory.CategoryId); foreach (var item in discountedProducts) { var discountedInCartId = _cartProductDAL.Get(x => x.ProductId == item.ProductId).CartId; var updatedCartItem = _cartDAL.Get(x => x.Id == discountedInCartId); if (campaignCategory.DiscountTypeId == (int)EnumDiscountTypes.Rate)//Convert.ToInt32(discountTypeItems.Where(a => a.Title == "Rate").Select(x => x.Id).ToList())) { //kampanyanın oran bazında indirimli halinin sepet tutarına yansıtılmış hali var discountedPriceForRate = totalPricebyCampaignCategory - (totalPricebyCampaignCategory * campaignCategory.DiscountRate) / 100; updatedCartItem.TotalPrice = discountedPriceForRate; } else if (campaignCategory.DiscountTypeId == (int)EnumDiscountTypes.Amount) //Convert.ToInt32(discountTypeItems.Where(a => a.Title == "Amount").Select(x => x.Id).ToList())) { //kampanyanın miktar bazında indirimli halinin sepet tutarına yansıtılmış hali var discountedPriceForAmount = totalPricebyCampaignCategory - campaignCategory.DiscountRate; updatedCartItem.TotalPrice = discountedPriceForAmount; } _cartDAL.Update(updatedCartItem); viewCartItem.TotalPriceInCart = updatedCartItem.TotalPrice; viewCartItem.DiscountedTotalPrice = updatedCartItem.TotalPrice; viewCartItem.Amount = item.TotalAmount; viewCartItem.CartId = item.CartId; viewCartItem.ProductName = item.ProductName; viewCartItem.TotalPrice = item.TotalAmount * item.UnitPrice; viewCartItem.UnitPrice = totalPriceInCart.FirstOrDefault().UnitPrice; } } else { viewCartItem.TotalPriceInCart = totalPriceInCart.FirstOrDefault().TotalPrice; viewCartItem.ErrorInfo = "Sepette kampanyalı olan kategorilere ait yeterli veya hiç ürün yok !"; //sepette kampanyalı kategoriye ait ürün yok! } } return(viewCartItem); }
public List <Category> GetAll() { return(_categoryDal.GetList()); }
/// <summary> /// 获得数据列表 /// </summary> public DataSet GetList(string strWhere) { return(dal.GetList(strWhere)); }
public ActionResult Navbar() { return(PartialView(categoryDAL.GetList().OrderBy(x => x.CategoryName).ToList())); }
public IList <Category> GetAll() { return(_categoryDAL.GetList()); }
public List <Categories> getCategories() { return(_categoryDAL.GetList()); }