public async Task <ActionResult> Create( JournalCreateModel journal) { return(await PostResult( async() => await journalService.Create(journal), journalId => new { Id = journalId }, nameof(journal) )); }
public async Task <(string, ServiceModelState)> Create( JournalCreateModel model) { var journal = new Journal { Id = Guid.NewGuid().ToString() }; await ValidateAccounts(journal, model); if (IsServiceFailure) { return(null, modelState); } model.Attach(journal); await context.Journals.AddAsync(journal); await context.SaveChangesAsync(); return(journal.Id, null); }