コード例 #1
0
        public async Task <IActionResult> Create([FromForm] EventInputModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var entity = model.ToEntity(await GetCurrentUser());

            await _database.AddAsync(entity);

            await _database.SaveChangesAsync();

            return(RedirectToAction(nameof(View), new { id = entity.Id }));
        }