コード例 #1
0
ファイル: EventRepositoryTest.cs プロジェクト: 224107/PT
        public void AddEventTest()
        {
            Customer customer = new Customer(101, "Matt", "Knox");
            Sale     sale     = new Sale(customer, DateTime.Today, productRepository.GetProductsState());

            eventRepository.AddEvent(sale);
            Assert.AreEqual(1, eventRepository.GetAllEvents().Count);
        }
コード例 #2
0
 public void AddSale(Product product, Customer customer, int qty)
 {
     if (productRepository.GetProductAmountById(product.Id) < qty)
     {
         throw new Exception("There's no Product available");
     }
     else
     {
         productRepository.ReduceAmountOfProduct(product, qty);
         Sale saleEvent = new Sale(customer, DateTime.Today, productRepository.GetProductsState());
         eventRepository.AddEvent(saleEvent);
     }
 }
コード例 #3
0
        public ActionResult Create(Event @event, string str)
        {
            if (ModelState.IsValid)
            {
                Ievent.AddEvent(@event, HttpContext.User.Identity.Name);

                return(RedirectToAction("Home", "Event"));
            }
            return(View());
        }
コード例 #4
0
 public IActionResult AddEvent(EventModel model)
 {
     return(Ok(_event.AddEvent(model)));
 }
コード例 #5
0
 public int Create([FromBody] TblEvents events)
 {
     return(objevent.AddEvent(events));
 }