Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("DataID,EnergyConsumption,GasConsumption,EnergySaving,GasSaving,Date,DepartmentID")] Data @data)
        {
            if (ModelState.IsValid)
            {
                _context.Add(@data);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(@data));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("DepartmentID,Name")] Department department)
        {
            if (ModelState.IsValid)
            {
                _context.Add(department);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(department));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("UserID,UserName,PassWord,Email,IsAdmin")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }