public async Task <IActionResult> Create(Rule Rule) { if (ModelState.IsValid) { await ruleRepository.Create(User, Rule); return(RedirectToAction(nameof(Index), new { Rule.DeviceId })); } return(View(Rule)); }