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)); }
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)); }
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)); }