public async Task <ApiResponse <IdNameModel> > Create(TrainSetCreateModel model) { var user = await CurrentUser(); if (user == null) { return(Failed("No user")); } var entity = new TrainSet { Name = model.Name, SourceId = model.SourceId, UserId = user.Id, Type = model.Type, MaxCount = model.MaxCount, MinCount = model.MinCount, InputWordsCount = 3, }; entity = await _trainSets.Add(entity); if (entity == null) { return(Failed("Server error")); } return(Ok(new IdNameModel { Id = entity.Id, Name = entity.Name })); }
public async Task <IActionResult> Create([FromBody] TrainSetCreateModel model) { return(Ok(await _trainSet.Create(model))); }