public async Task <Command> Handle(Command command, CancellationToken cancellationToken) { var timeline = await _siganthaContext .Timelines .FirstOrDefaultAsync(s => s.Id == command.Id); timeline.Name = command.Name; timeline.Content = command.Content; timeline.Modified = DateTime.UtcNow; await _siganthaContext.SaveChangesAsync(); return(command); }
public async Task <Result> Handle(Command command, CancellationToken cancellationToken) { var timeline = await _siganthaContext .Timelines .FirstOrDefaultAsync(s => s.Id == command.Id); _siganthaContext.Timelines.Remove(timeline); await _siganthaContext.SaveChangesAsync(); return(new Result { Id = timeline.Id, Name = timeline.Name, Content = timeline.Content }); }
public async Task <Result> Handle(Command command, CancellationToken cancellationToken) { var timeline = new Timeline { Name = command.Name, Content = command.Content, Created = DateTime.UtcNow, Modified = DateTime.UtcNow }; _siganthaContext.Timelines.Add(timeline); await _siganthaContext.SaveChangesAsync(); return(new Result { Id = timeline.Id }); }
public async Task <Command> Handle(Command command, CancellationToken cancellationToken) { var era = await _siganthaContext .Eras .FirstOrDefaultAsync(s => s.Id == command.Id); era.Name = command.Name; era.Content = command.Content; era.Start = command.Start; era.End = command.End; era.Modified = DateTime.UtcNow; await _siganthaContext.SaveChangesAsync(); return(command); }
public async Task <Result> Handle(Command command, CancellationToken cancellationToken) { var era = new Era { Name = command.Name, Content = command.Content, Start = command.Start, End = command.End, Created = DateTime.UtcNow, Modified = DateTime.UtcNow }; _siganthaContext.Eras.Add(era); await _siganthaContext.SaveChangesAsync(); return(new Result { Id = era.Id }); }
public async Task <Result> Handle(Command command, CancellationToken cancellationToken) { var era = await _siganthaContext .Eras .FirstOrDefaultAsync(s => s.Id == command.Id); _siganthaContext.Eras.Remove(era); await _siganthaContext.SaveChangesAsync(); return(new Result { Id = era.Id, Name = era.Name, Content = era.Content, Start = era.Start, End = era.End }); }