public string UpdateFlow(KnowledgeMap flow) { if (_dbContext.KnowledgeMaps.Any(f => f.Id != flow.Id && f.Identifier == flow.Identifier)) { return($"{flow.Identifier}已经存在"); } _dbContext.KnowledgeMaps.Update(flow); _dbContext.SaveChanges(); return(string.Empty); }
public async Task <string> CreateFlowAsync(KnowledgeMap flow) { if (_dbContext.KnowledgeMaps.Any(f => f.Identifier == flow.Identifier)) { return($"{flow.Identifier}已存在"); } await _dbContext.KnowledgeMaps.AddAsync(flow).ConfigureAwait(false); await _dbContext.SaveChangesAsync().ConfigureAwait(false); return(string.Empty); }
public async Task <IActionResult> CreateFlow([FromBody] CreateFlowViewModel vm) { var flow = new KnowledgeMap { CreationTime = DateTime.Now, Name = vm.Name, Identifier = vm.Key, Remark = vm.Remark }; var error = await _knowledgeService.CreateFlowAsync(flow).ConfigureAwait(false); if (!string.IsNullOrEmpty(error)) { return(BadRequest(error)); } return(Ok()); }
public static string getFileName(string course, string sizex, string sizey) { KnowledgeMap.getFileName(userid, course, sizex, sizey); return(userid + course); }