示例#1
0
        public async Task <IActionResult> Create([Bind("EmployeeId,FirstName,LastName,Email,Password,DateCreated")] Employees employees)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employees);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employees));
        }
        public async Task <IActionResult> Create([Bind("StatusId,Title,DateCreated")] Statuses statuses)
        {
            if (ModelState.IsValid)
            {
                _context.Add(statuses);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(statuses));
        }
        public async Task <IActionResult> Create([Bind("ResidentId,FirstName,LastName,Address,UnitNumber,City,State,Zip,Phone,Email,DateCreated")] Residents residents)
        {
            if (ModelState.IsValid)
            {
                _context.Add(residents);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(residents));
        }
示例#4
0
        public async Task <IActionResult> Create([Bind("WorkOrderId,Description,ResidentId,StatusId,EmployeeId,Notes,DateCompleted,DateUpdated,DateCreated")] WorkOrders workOrders)
        {
            if (ModelState.IsValid)
            {
                _context.Add(workOrders);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeId"] = new SelectList(_context.Employees, "EmployeeId", "Email", workOrders.EmployeeId);
            ViewData["ResidentId"] = new SelectList(_context.Residents, "ResidentId", "Address", workOrders.ResidentId);
            ViewData["StatusId"]   = new SelectList(_context.Statuses, "StatusId", "Title", workOrders.StatusId);
            return(View(workOrders));
        }