示例#1
0
        public async override Task Execute(DeleteVehicleCategoryCommand command, User?user)
        {
            var cat = await service.GetById(command.Id);

            if (!cat.IsOwner(user !))
            {
                throw new AuthorizationException();
            }

            await service.Delete(cat);
        }
示例#2
0
        public async override Task <VehicleCategoryView> Execute(UpdateVehicleCategoryCommand command, User?user)
        {
            VehicleCategory cat = await service.GetById(command.Id);

            if (!cat.IsOwner(user !))
            {
                throw new AuthorizationException();
            }

            await service.Update(
                cat,
                new VehicleCategoryUpdate(
                    command.Name,
                    command.Description
                    )
                );

            throw new NotImplementedException();
            // return mapper.Map<VehicleCategory, VehicleCategoryView>(cat);
        }