public async Task <IResult> Handle(Validator validator, AddVendorCommand addVendorCommand, IMapper mapper, Request request) { await validator.GuardAsync(request); var addedVendor = addVendorCommand.Execute(request); var model = mapper.Map <VendorModel>(addedVendor); return(AdminApiResponse <VendorModel> .Created(model, "Vendor", $"/{FeatureConstants.Vendors}/{model.VendorId}")); }
public async Task <IResult> Handle(Validator validator, IAddApplicationCommand addApplicationCommand, IMapper mapper, IUsersContext db, Request request) { await validator.GuardAsync(request); GuardAgainstInvalidEntityReferences(request, db); var addedApplicationResult = addApplicationCommand.Execute(request); var model = mapper.Map <ApplicationResult>(addedApplicationResult); return(AdminApiResponse <ApplicationResult> .Created(model, "Application", $"/{FeatureConstants.Applications}/{model.ApplicationId}")); }