public async Task <IActionResult> EditSmtp(Guid id) { var existing = await _ctx.FindTransportAsync(id); if (existing != null && existing.Type == TransportType.Smtp) { var model = new EditSmtpViewModel(existing); return(View(model)); } return(NotFound()); }
public async Task <IActionResult> EditSmtp(Guid id, EditSmtpViewModel model) { if (ModelState.IsValid) { var existing = await _ctx.FindTransportAsync(id); if (existing != null && existing.Type == TransportType.Smtp) { model.UpdateDbModel(existing); await _ctx.SaveChangesAsync(); return(RedirectToAction(nameof(Details), new { id })); } return(NotFound()); } return(View(model)); }