public async Task <Response> Handle(Request request, CancellationToken cancellationToken) { var customer = new Customer(request.Customer.Firstname, request.Customer.Lastname); _context.Add(customer); await _context.SaveChangesAsync(cancellationToken); return(new(customer.ToDto())); }
public async Task <Unit> Handle(Request request, CancellationToken cancellationToken) { var customer = await _context.LoadAsync <Customer>(request.CustomerId); customer.Reomve(_dateTime.UtcNow); await _context.SaveChangesAsync(cancellationToken); return(new()); }
public async Task <Response> Handle(Request request, CancellationToken cancellationToken) { var customer = await _context.LoadAsync <Customer>(request.Customer.CustomerId); customer.Update( request.Customer.Firstname, request.Customer.Lastname, request.Customer.Email, request.Customer.PhoneNumber); await _context.SaveChangesAsync(cancellationToken); return(new(customer.ToDto())); }