示例#1
0
        public async Task <int> CreateAsync(ToDoDto toDoDto)
        {
            ToDoDbModel toDo = toDoEntityConverter.Convert(toDoDto);
            await dbContext.AddAsync(toDo);

            await dbContext.SaveChangesAsync();

            return(toDo.Id);
        }
示例#2
0
 public ToDoDto Convert(ToDoDbModel source)
 {
     return(source != null
         ? new ToDoDto
     {
         Id = source.Id,
         Description = source.Description,
         IsCompleted = source.IsCompleted
     } : null);
 }