//[ValidateAntiForgeryToken]
        public async Task <IActionResult> Create([Bind("Id,Name,Address")] Customer customer)
        {
            _context.Add(customer);
            await _context.SaveChangesAsync();

            return(Ok());
        }
        //[ValidateAntiForgeryToken]
        public async Task <IActionResult> Create([Bind("Id,Name,Address")] Store store)
        {
            if (ModelState.IsValid)
            {
                _context.Add(store);
                await _context.SaveChangesAsync();

                return(Ok());
            }
            return(Ok());
        }
Example #3
0
        //[ValidateAntiForgeryToken]
        public async Task <IActionResult> Create([Bind("Id,Name,Price")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(Ok());
            }
            return(Ok());
        }
Example #4
0
        //[ValidateAntiForgeryToken]
        public async Task <IActionResult> Create([Bind("Id,ProductId,CustomerId,StoreId,DateSold")] Sales sales)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sales);
                await _context.SaveChangesAsync();

                return(Ok());
            }
            ViewData["CustomerId"] = new SelectList(_context.Customer, "Id", "Name", sales.CustomerId);
            ViewData["ProductId"]  = new SelectList(_context.Product, "Id", "Name", sales.ProductId);
            ViewData["StoreId"]    = new SelectList(_context.Store, "Id", "Name", sales.StoreId);
            return(Ok());
        }