static void Main(string[] args) { Gamer gamer = new Gamer { Id = 1, FirstName = "EBRU", LastName = "MERD", BirthYear = "2002", IdentityId = "123456" }; Game game = new Game { Id = 2, GameName = "Valorant", GamePrice = 70 }; Compaign compaign = new Compaign { Id = 3, CampaignName = "3 al 1 öde", CampaignDiscount = 1 }; GamerManager gamerManager = new GamerManager(new UserValidationManager()); gamerManager.Add(gamer); SalesManager salesManager = new SalesManager(); salesManager.Add(gamer, game, compaign); }
public ActionResult Add(Sales sales) { string message = ""; if (_salesManager.Add(sales)) { message = "Sales Saved"; } else { message = "Not saved"; } ViewBag.Message = message; SalesViewModel salesViewModel = new SalesViewModel(); salesViewModel.CustomerSelectListItems = _customerManager. GetAll().Select(c => new SelectListItem() { Value = c.Id.ToString(), Text = c.Name }).ToList(); salesViewModel.CategorySelectListItems = _categoryManager.GetAll() .Select(c => new SelectListItem() { Value = c.Id.ToString(), Text = c.Name }).ToList(); ViewBag.Category = salesViewModel.CategorySelectListItems; return(View(salesViewModel)); }
static void Main(string[] args) { Gamer gamer = new Gamer { IdentityNumber = 123456; FirstName = "Doğukan"; LastName = "Orhan"; BirthYear = 1996; }; Game game = new Game { GameName = "Snake"; GamePrice = 10; }; Campaign campaign = new Campaign { CampaignName = "Sales Discount"; CampaignDiscount = 0.50; }; GamerManager gamerManager = new GamerManager(); gamerManager.Add(gamer); SalesManager salesManager = new SalesManager(); salesManager.Add(gamer, game, campaign); }
public ActionResult Index(SalesVM salesVM) { _salesManager.Add(salesVM.SalesProducts); salesVM.Customers = _customerManager.GetAll(); salesVM.Products = _productManager.GetAll(); return(View(salesVM)); }
public ActionResult Add(SalesViewModel salesViewModel) { string message = ""; if (ModelState.IsValid) { var resetLoyaltyPoint = salesViewModel.LoyaltyPoint - (salesViewModel.LoyaltyPoint / 10); var newLoyaltyPoint = Convert.ToInt32(resetLoyaltyPoint + ((salesViewModel.GrandTotal) / 1000)); var customer = _customerManager.GetById(salesViewModel.CustomerId); customer.LoyaltyPoint = newLoyaltyPoint; _customerManager.Update(customer); salesViewModel.SalesCode = _salesManager.GetSalesCode(); SalesMaster salesMaster = Mapper.Map <SalesMaster>(salesViewModel); if (_salesManager.Add(salesMaster)) { message = "Sale Info Saved"; } else { message = "Sale Info not saved"; } } else { var errors = ModelState.Select(x => x.Value.Errors) .Where(y => y.Count > 0) .ToList(); message = "modelstate is invalid"; } ViewBag.Message = message; ModelState.Clear(); SalesViewModel emptySalesViewModel = new SalesViewModel(); emptySalesViewModel.CustomerSelectListItems = _customerManager.GetAll() .Select(c => new SelectListItem() { Value = c.Id.ToString(), Text = c.Name }).ToList(); emptySalesViewModel.CategorySelectListItems = _categoryManager.GetAll() .Select(c => new SelectListItem() { Value = c.Id.ToString(), Text = c.Name }).ToList(); return(View(emptySalesViewModel)); }
public ActionResult Add(Sales sales) { sales.CustomerLookUp = _salesManager.GetCustomerSelectListItems(); sales.ProductLookUp = _salesManager.GetProductSelectListItems(); if (sales.SalesDetailses != null && sales.SalesDetailses.Count > 0) { var isAdded = _salesManager.Add(sales); if (isAdded) { ViewBag.SMsg = "Sales Success"; return(View(sales)); } } ViewBag.FMsg = "sales Failed"; return(View(sales)); }
public void Add(Sales sales) { string message = ""; if (_salesManager.Add(sales)) { message = "Sales Completed Successfully"; } else { message = "Failed"; } ViewBag.Message = message; Add(); }
static void Main(string[] args) { GamerManager gamerManager = new GamerManager(new ValidateManager()); gamerManager.Save(new Gamer { Id = 1, FirstName = "Elif", LastName = "Aydın", NationalityId = "123456789" }); gamerManager.Delete(new Gamer { Id = 2, FirstName = "Kader", LastName = "Demir", NationalityId = "987654321" }); gamerManager.Update(new Gamer { Id = 3, FirstName = "Nur", LastName = "Acartürk", NationalityId = "012345678" }); CampaignManager campaignManager = new CampaignManager(); CampaignManager campaignManager1 = new CampaignManager(); campaignManager.Add(new Campaign() { CampaignName = "Yaz Kampanyası", CampaignDetail = "Öğrenci İndirimi", }); campaignManager1.Update(new Campaign() { CampaignName = "Kış Kampanyası", CampaignDetail = "Çalışan İndirimi", }); campaignManager1.Delete(new Campaign() { CampaignName = "Yeni Yıl Kampanyası", CampaignDetail = "Herkes İçin İndirim", }); SalesManager saleManager = new SalesManager(new CampaignManager()); saleManager.Add(new Gamer { Id = 1 }, new Campaign { CampaignName = "Kış Kampanyası" }); }
static void Main(string[] args) { GamerManager gamerManager = new GamerManager(new GamerCheckManager()); //Yeni Oyuncu tanımlama Gamer gamer1 = new Gamer { Id = 1, FirstName = "Galip", LastName = "Doğan", NationalityId = 11111111111, BirthDay = new DateTime(1986, 11, 4) }; //Yeni Oyuncu Ekleme gamerManager.Add(gamer1); //Yeni Oyun tanımlama Game game1 = new Game(); game1.Id = 1; game1.GameName = "Oyun1"; //Yeni Kampanya tanımlama Campaign campaign1 = new Campaign(); campaign1.CampaignName = "Yeni Kampanya"; campaign1.CapmpaignDiscount = 25; //Oyun Ekleme GameManager gameManager = new GameManager(); gameManager.Add(game1); //Kampanya Ekleme CampaignManager campaignManager = new CampaignManager(); campaignManager.Add(campaign1); //Satış yapıldı SalesManager salesManager = new SalesManager(); salesManager.Add(gamer1, game1, campaign1); }
public ActionResult AddSales(SaleViewModel saleViewModel) { SaleDetailsViewModel saleDetialsViewModel = new SaleDetailsViewModel(); string message = ""; if (ModelState.IsValid) { var resetLoyaltyPoint = saleViewModel.LoyalityPoint - (saleViewModel.LoyalityPoint / 10); var newLoyaltyPoint = Convert.ToInt16(resetLoyaltyPoint + ((saleViewModel.GrandTotal) / 1000)); var customer = _customerManager.GetById(saleViewModel.CustomerId); customer.Loyality = newLoyaltyPoint; _customerManager.Update(customer); Sale sale = Mapper.Map <Sale>(saleViewModel); _salesManager.Add(sale); } else { message = "modelstate is invalid"; } saleViewModel.CustomerSelectListItems = _customerManager .GetAll() .Select(c => new SelectListItem() { Value = c.Id.ToString(), Text = c.Name }).ToList(); saleDetialsViewModel.CategorySelectListItems = _categoryManager.GetAll().Select(c => new SelectListItem() { Value = c.Id.ToString(), Text = c.Name }).ToList(); ViewBag.CategoryId = saleDetialsViewModel.CategorySelectListItems; saleViewModel.Sales = _salesManager.GetAll(); return(View(saleViewModel)); }
static void Main(string[] args) { SalesManager salesManager = new SalesManager(); Game game = new Game { ID = 1, GameName = "Witcher 3", GameType = "RPG" }; Campaign campaign = new Campaign { ID = 1, CampaignName = "Summer Sales" }; User gamer = new Gamer { ID = 1, FirstName = "Cemilcan", LastName = "Sağdıç", TCNo = "12345678910" }; Sales sales = new Sales(); sales.ID = 1; sales.game = game; sales.Price = 120; sales.user = (Gamer)gamer; salesManager.Add(sales); Console.Read(); }
private bool Add(Sales sales) { return(_salesManager.Add(sales)); }