コード例 #1
0
        public async Task <IActionResult> Create([Bind("ID,Name,Email,Telephone,BirthDay,Sallary")] SalesAdvisor salesAdvisor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(salesAdvisor);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(salesAdvisor));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("ID,Rate,Easy,Friendly,EnoughInfo,Recomend,Suggestion,SalesOrderId")] Survey survey)
        {
            if (ModelState.IsValid)
            {
                _context.Add(survey);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["SalesOrderId"] = new SelectList(_context.SalesOrder, "ID", "ID", survey.SalesOrderId);
            return(View(survey));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("ID,ProductName,SalePrice,SaleDate,SalesAdvisorId,CustomerId")] SalesOrder salesOrder)
        {
            if (ModelState.IsValid)
            {
                _context.Add(salesOrder);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["CustomerId"]     = new SelectList(_context.Customer, "ID", "ID", salesOrder.CustomerId);
            ViewData["SalesAdvisorId"] = new SelectList(_context.SalesAdvisor, "ID", "ID", salesOrder.SalesAdvisorId);
            return(View(salesOrder));
        }