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); }
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); } }
public ActionResult Create(Event @event, string str) { if (ModelState.IsValid) { Ievent.AddEvent(@event, HttpContext.User.Identity.Name); return(RedirectToAction("Home", "Event")); } return(View()); }
public IActionResult AddEvent(EventModel model) { return(Ok(_event.AddEvent(model))); }
public int Create([FromBody] TblEvents events) { return(objevent.AddEvent(events)); }