public async Task <string> PostAsync(NoteInfoEntity PEntity) { ExcuteResult actResult = new ExcuteResult(); if (await _DataRepository.AddAsync(PEntity).ConfigureAwait(false) > 0) { actResult.SetValues(p_state: 0, p_msg: "保存成功", p_tag: PEntity?.Id); } else { actResult.SetValues(1, "保存失败"); } return(JsonConvert.SerializeObject(actResult)); }
public async Task CheckEntityIsCorrect() { //Arranges var note = NoteBuilder.WithDefaultValues(); //Acts await _noteRepository.AddAsync(note); var noteFromDb = await _notePadContext.Notes.FindAsync(note.Id); //Asserts Assert.Equal(note.Id, noteFromDb.Id); Assert.Equal(note.Title, noteFromDb.Title); Assert.Equal(note.Body, noteFromDb.Body); Assert.Equal(note.DateTime, noteFromDb.DateTime); }
public async Task <string> Add(NoteAddUpdateDto n) { var note = await _noteRepository.AddAsync(n.NewNote()); return(note.Id); }