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