public ActionResult Update(Guid id) { Road item = rs.GetByID(id); ViewBag.DistricID = new SelectList(ds.GetActive(), "ID", "Name", item.DistrictID); return(View(rs.GetByID(id))); }
public ActionResult Insert() { ViewBag.ProvinceID = new SelectList(ilservice.GetActive(), "ID", "ProvinceName"); ViewBag.CountryID = new SelectList(ilceservice.GetActive(), "ID", "CountryName"); ViewBag.DistrictID = new SelectList(semtservice.GetActive(), "ID", "DistrictName"); ViewBag.RestaurantID = new SelectList(rs.GetActive(), "ID", "Name"); return(View()); }
public ActionResult Index() { AddDistrictWM model = new AddDistrictWM() { Cities = _cityService.GetActive(), Districts = _districtService.GetActive(), }; return(View(model)); }
public ActionResult Update(Guid id) { Address item = ads.GetByID(id); ViewBag.ProvinceID = new SelectList(ps.GetActive(), "ID", "Name", item.ProvinceID); ViewBag.RegionToID = new SelectList(rs.GetActive(), "ID", "Name", item.RegionToID); ViewBag.DistrictID = new SelectList(ds.GetActive(), "ID", "Name", item.DistrictID); ViewBag.RoadID = new SelectList(rds.GetActive(), "ID", "Name", item.RoadID); ViewBag.StreetID = new SelectList(ss.GetActive(), "ID", "Name", item.StreetID); ViewBag.BuildID = new SelectList(bs.GetActive(), "ID", "Name", item.BuildID); return(View(ads.GetByID(id))); }
public ActionResult Add() { AddAdvertisementVM model = new AddAdvertisementVM() { appUsers = _appUserService.GetActive(), Cities = _cityService.GetActive(), Districts = _districtService.GetActive(), Pettypes = _pettypeService.GetActive(), Races = _raceService.GetActive(), advertisements = _advertisementService.GetActive(), }; return(View(model)); }
public ActionResult Insert(Order item, Guid?appUserID, Guid?productID) { ViewBag.ProvinceID = new SelectList(prs.GetActive(), "ID", "Name", item.ProvinceID); ViewBag.RegionToID = new SelectList(rs.GetActive(), "ID", "Name", item.RegionToID); ViewBag.DistricID = new SelectList(ds.GetActive(), "ID", "Name", item.DistrictID); ViewBag.RoadID = new SelectList(rds.GetActive(), "ID", "Name", item.RoadID); ViewBag.StreetID = new SelectList(ss.GetActive(), "ID", "Name", item.StreetID); ViewBag.BuildID = new SelectList(bs.GetActive(), "ID", "Name", item.BuildID); if (appUserID == null) { uyeOlmayan.Name = item.Name; uyeOlmayan.SurName = item.SurName; uyeOlmayan.Phone = item.Phone; uyeOlmayan.EmailAddress = item.EmailAddress; cnms.Add(uyeOlmayan); } AppUser kullanici = aus.GetByID((Guid)appUserID); ViewBag.Kullanici = kullanici.IsAdministrator; item.AppUserID = (Guid)appUserID; item.OrderDate = DateTime.Now; item.RequiredDate = DateTime.Now.AddDays(7); bool result = os.Add(item); if (result) { gelenDetay.Order = item; Product urun = ps.GetByID((Guid)productID); gelenDetay.Product = urun; if (cams.Any(m => m.ProductID == urun.ID)) { Campaing kampanya = cams.GetByDefault(x => x.ProductID == urun.ID); urun.UnitPrice = urun.UnitPrice - (urun.UnitPrice * (decimal)kampanya.Discount); ps.Update(urun); } ods.Add(gelenDetay); return(View()); } ViewBag.Message = "Sipariş Oluşturulamadı, Bilgileri Kontrol Ediniz"; return(View()); }
public ActionResult GetOrder(Order item) { bool result; ViewBag.ShipID = new SelectList(shps.GetActive(), "ID", "CompanyName", item.ShipID); ViewBag.ProvinceID = new SelectList(prs.GetActive(), "ID", "Name", item.ProvinceID); ViewBag.RegionToID = new SelectList(rs.GetActive(), "ID", "Name", item.RegionToID); ViewBag.DistrictID = new SelectList(ds.GetActive(), "ID", "Name", item.DistrictID); ViewBag.RoadID = new SelectList(rds.GetActive(), "ID", "Name", item.RoadID); ViewBag.StreetID = new SelectList(strs.GetActive(), "ID", "Name", item.StreetID); ViewBag.BuildID = new SelectList(bs.GetActive(), "ID", "Name", item.BuildID); ViewBag.ProvinceID = new SelectList(prs.GetActive(), "ID", "Name"); List <SelectListItem> lists = new List <SelectListItem>() { new SelectListItem() { Text = "Seçiniz", Value = "0" } }; ViewData["RegionToID"] = lists; ViewData["DistrictID"] = lists; ViewData["RoadID"] = lists; ViewData["StreetID"] = lists; ViewData["BuildID"] = lists; ViewBag.Freight = 5m; List <UrunSepeti> sepet; if (Session["oturum"] != null) { gelen = (AppUser)Session["oturum"]; } else if (Session["admin"] != null) { gelen = (AppUser)Session["admin"]; } else if (Session["sepet"] != null) { Campaing kampanya = new Campaing(); OrderDetail orderDetay = new OrderDetail(); sepet = (List <UrunSepeti>)Session["sepet"]; foreach (UrunSepeti urun in sepet) { Product good = ps.GetByID(urun.ID); ProductDetail goodDetail = pds.GetByID(urun.ProductDetailID); item.AppUserID = good.AppUserID; uyeOlmayan.Name = item.Name; uyeOlmayan.SurName = item.SurName; uyeOlmayan.Phone = item.Phone; uyeOlmayan.EmailAddress = item.EmailAddress; cnms.Add(uyeOlmayan); item.OrderDate = DateTime.Now; item.RequiredDate = DateTime.Now.AddDays(7); os.Add(item); if (ps.Any(m => m.ID == urun.ID)) { if (cams.Any(x => x.ProductID == urun.ID)) { kampanya = cams.GetByDefault(x => x.ProductID == urun.ID); } else { kampanya.Discount = 0f; } goodDetail.UnitInStock -= urun.Quantity; pds.Update(goodDetail); orderDetay.ProductID = good.ID; orderDetay.OrderID = item.ID; orderDetay.Quantity = urun.Quantity; orderDetay.Price = (good.UnitPrice - (good.UnitPrice * (decimal)kampanya.Discount)) * orderDetay.Quantity; ods.Add(orderDetay); } } Session.Remove("sepet"); TempData["siparis"] = "Siparişiniz alındı"; return(RedirectToAction("Index", "ShoppingCart")); } if (gelen != null) { List <ShoppingCart> urunler = scs.GetDefault(m => m.AppUserID == gelen.ID && m.Status != Core.Entity.Enum.Status.Deleted); Campaing kampanya = new Campaing(); OrderDetail orderDetay = new OrderDetail(); foreach (ShoppingCart urun in urunler) { Product good = ps.GetByID(urun.ProductID); item.AppUserID = good.AppUserID; item.Name = gelen.Name; item.SurName = gelen.SurName; item.Phone = gelen.Phone; item.EmailAddress = gelen.EmailAddress; item.OrderDate = DateTime.Now; item.RequiredDate = DateTime.Now.AddDays(7); os.Add(item); if (cams.Any(x => x.ProductID == urun.ProductID)) { kampanya = cams.GetByDefault(x => x.ProductID == urun.ProductID); indirim = (float)kampanya.Discount; } else { indirim = 0f; } ProductDetail goodDetail = pds.GetByID((Guid)urun.ProductDetailID); goodDetail.UnitInStock -= urun.Quantity; pds.Update(goodDetail); orderDetay.AppUserID = gelen.ID; orderDetay.ProductID = good.ID; orderDetay.OrderID = item.ID; orderDetay.Quantity = urun.Quantity; orderDetay.Price = (good.UnitPrice - (good.UnitPrice * (decimal)indirim)) * orderDetay.Quantity; ods.Add(orderDetay); scs.Remove(urun.ID); } TempData["siparis"] = "Siparişiniz alındı"; return(RedirectToAction("Index", "ShoppingCart")); } return(View()); }