public ActionResult <StoryCreationViewModel> Post([FromBody] UpdateStoryViewModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var ownerId = HttpContext.User.Identity.Name; var creationTime = ((DateTimeOffset)DateTime.UtcNow).ToUnixTimeSeconds(); var storyId = Guid.NewGuid().ToString(); var story = new Story { Id = storyId, Title = model.Title, Content = model.Content, Tags = model.Tags, CreationTime = creationTime, LastEditTime = creationTime, OwnerId = ownerId, Draft = true }; storyRepository.Add(story); storyRepository.Commit(); return(new StoryCreationViewModel { StoryId = storyId }); }
public void Commit() { _innerRepository.Commit(); }