コード例 #1
0
        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());
        }
コード例 #2
0
        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));
        }