Ejemplo n.º 1
0
        public async Task <Seller> CreateSellerAsync(Seller seller)
        {
            await _salesManagementContext.AddAsync(seller);

            await _salesManagementContext.SaveChangesAsync();

            return(seller);
        }
Ejemplo n.º 2
0
        public async Task <Sale> CreateSaleAsync(Sale sale)
        {
            await _salesManagementContext.AddAsync(sale);

            await _salesManagementContext.SaveChangesAsync();

            return(sale);
        }
        public async Task <IActionResult> Create([Bind("Id,Name")] Department department)
        {
            if (ModelState.IsValid)
            {
                _context.Add(department);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(department));
        }
        public async Task <IActionResult> Create([Bind("Id,FullName")] SalesPerson salesPerson)
        {
            if (ModelState.IsValid)
            {
                salesPerson.Sales      = new List <Sale>();
                salesPerson.Commission = 0;
                _context.Add(salesPerson);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(salesPerson));
        }
        public async Task <IActionResult> Create([Bind("SaleId,SalesPersonFullName,Amount,Date")] Sale sale)
        {
            if (ModelState.IsValid)
            {
                SalesPerson employee = await _context.SalesPeople.Include(sp => sp.Sales)
                                       .FirstOrDefaultAsync(sp => sp.FullName == sale.SalesPersonFullName);

                sale.SalesEmployee = employee;
                _context.Add(sale);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SalesPersonFullName"] = new SelectList(_context.SalesPeople, "FullName", "FullName", sale.SalesPersonFullName);
            return(View(sale));
        }
Ejemplo n.º 6
0
 public async Task Insert(Seller obj)
 {
     _context.Add(obj);
     await _context.SaveChangesAsync();
 }